简体   繁体   English

如何从交易所获取所有通讯组列表

[英]How to get all distribution lists from exchange

I am trying to grab all of the distribution lists from Exchange. 我正在尝试从Exchange获取所有通讯组列表。 I am doing the same thing with Active Directory, where I am pulling the emails. 我使用Active Directory做同样的事情,在其中提取电子邮件。 I am able to do that using: 我可以使用以下方法做到这一点:

List<string> emailAddresses = new List<string>();

DirectoryEntry entry = new DirectoryEntry("LDAP://my.domain");
DirectorySearcher dSearch = new DirectorySearcher(entry);
dSearch.Filter = "(objectClass=user)";
foreach (SearchResult sResultSet in dSearch.FindAll())
{
     if (sResultSet.Properties["mail"].Count > 0)
     {
         emailAddresses.Add(sResultSet.Properties["mail"][0].ToString());
     }              
}

What would be the best and most efficient way to grab the distribution lists from exchange? 从交换中获取通讯组列表的最佳和最有效的方法是什么?

If you are using O365, you just need to use the API to read groups in Office 365. Here is an example how to do this: https://dev.office.com/blogs/GroupsRESTAPI . 如果您使用的是O365,则只需要使用API​​即可读取Office 365中的组。这是如何执行此操作的示例: https : //dev.office.com/blogs/GroupsRESTAPI You do not need to use LDAP for that. 您不需要为此使用LDAP。 Here is another example on how to read groups in beta endpoint using graph api: http://graph.microsoft.io/docs/api-reference/beta/resources/group - Hope this helps. 这是另一个有关如何使用图形API读取Beta端点中的组的示例: http : //graph.microsoft.io/docs/api-reference/beta/resources/group-希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM