当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Get-MsolContact - 从 Office 365 获取联系人

作者:精品下载站 日期:2024-12-14 06:25:22 浏览:14 分类:玩电脑

Get-MsolContact - 从 Office 365 获取联系人


PowerShell 中的 Get-MsolContact cmdlet 可从 Microsoft Office 365 检索有关联系人的信息。联系人可以代表您的组织在 Office 365 中与之通信或跟踪的外部个人或实体。

这些联系人不是完整的用户帐户,而是出于各种目的存储在 Office 365 目录中。

在本文中,我们将讨论如何使用 Get-MsolContact cmdlet 从 Azure Active Directory 检索联系人。

如何获取 Office 365 中的所有联系人

若要获取 Office 365 租户中所有联系人的列表,请使用 PowerShell 中的 Get-MsolContact cmdlet。

Get-MsolContact

此命令检索联系人对象或联系人列表。

[玩转系统] Get-MsolContact - 从 Office 365 获取联系人

如何在 Office 365 中通过对象 ID 获取联系人

若要通过 Office 365 租户中的对象 ID 获取联系人对象,请使用以下命令。

Get-MsolContact -ObjectId 74b30b26-ee5e-478c-8346-641fcf094fb1

在上述 PowerShell 脚本中,Get-MsolContact cmdlet 使用 -ObjectId 参数指定联系人的对象 ID 并检索联系人。

PS C:\> Get-MsolContact -ObjectId 74b30b26-ee5e-478c-8346-641fcf094fb1                                                  
EmailAddress                        DisplayName
------------                        -----------
[email  Adam Blasco

如何获取与字符串匹配的联系人

要根据字符串筛选 Office 365 中的联系人,请使用以下命令。

Get-MsolContact -SearchString "adam" 

在上面的 PowerShell 脚本中,Get-MsolContact cmdlet 使用 -SearchString 参数指定联系人的显示名称或电子邮件地址应以“adam ”并从 Office 365 检索联系人。

PS C:\> Get-MsolContact -SearchString "adam"                                                                            
EmailAddress                        DisplayName
------------                        -----------
[email  Adam Blasco

酷提示:如何使用 PowerShell 过滤 Office 365 中的用户!

结论

希望上述有关如何在 PowerShell 中使用 Get-MsolContact cmdlet 检索 Office 365 中的联系人的文章对您有所帮助。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

相关链接

删除-MsolContact

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯