[英]How to get GAL id and use FindPeople with use of Microsoft.Exchange.WebServices
[英]Microsoft Exchange / Active Directory properties for mails to be used to read a GAL
我当前正在创建一个使用Outlook以及我公司中的Exchange Server / Active Directory来创建邮件的应用程序(因此,这里我已经有其他一些问题了)。
我目前正在尝试阅读GAL,以便在通过我的应用程序发送邮件时使用它。 从到目前为止我所看到的解决方案中,在我看来,我是从活动目录中读取邮件地址而不是连接到交换服务器的一种变体(我首先尝试使用Outlook,但除了只获得类型为“ EX”,因此它们存储在交换服务器上(我在那里没有得到太多信息)。
到目前为止,我所做的就是访问活动目录并从中读取所有用户
DirectorySearcher objsearch = new DirectorySearcher();
String strrootdse = objsearch.SearchRoot.Path;
DirectoryEntry objdirentry = new DirectoryEntry(strrootdse);
objsearch.Filter = "(& (mailnickname=*)(objectClass=user))";
objsearch.SearchScope = System.DirectoryServices.SearchScope.Subtree;
objsearch.PropertiesToLoad.Add("cn");
objsearch.PropertiesToLoad.Add("mail");
objsearch.PropertyNamesOnly = true;
objsearch.Sort.Direction = System.DirectoryServices.SortDirection.Ascending;
objsearch.Sort.PropertyName = "cn";
SearchResultCollection colresults = objsearch.FindAll();
List<String> arrGal = new List<String>();
foreach (SearchResult objresult in colresults)
{
arrGal.Add(objresult.GetDirectoryEntry().Properties["cn"].Value + ": " + objresult.GetDirectoryEntry().Properties["mail"].Value);
}
现在,在查看活动目录之后,我看到还存在代理,并且(至少在我公司中)“ mail”属性不一定是代理中列出的邮件地址之一。
因此,我发现了这两个属性:msExchShadowProxyAddresses,proxyAddresses
从我到目前为止所看到的样本中看,它们看起来是相同的,但是即使进行搜索,到目前为止,我在网上都找不到任何东西。
因此,当我尝试从活动目录中获取GAL时出现的问题?我可以同时使用这两个属性(因此它们始终是相同的)还是应该仅使用ShadowProxy属性,还是在那里需要特别考虑?
您需要使用AddressEntry.GetExchangeuser方法。 请参阅我对您其他帖子的回复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.