gpt4 book ai didi

c# - 微软交换 : How To Resolve A Distinguished Name

转载 作者:太空宇宙 更新时间:2023-11-03 13:40:38 27 4
gpt4 key购买 nike

我该如何解决:

/O=CHEESE/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=LHALA1

电子邮件地址?我必须使用 Exchange Web 服务吗?

最佳答案

我假设这是 legacyExchangeDN 属性。

尝试这样的事情:

string dn = "/O=CHEESE/OU=FIRST ADMINISTRATIVE GROUP/" +
"CN=RECIPIENTS/CN=LHALA1";
string MailAddress=string.Empty;
string user = string.Empty;

using (DirectorySearcher ds = new DirectorySearcher())
{
ds.Filter = string.Format("(&(ObjectClass=User)(legacyExchangeDN={0}))",
dn);
SearchResultCollection src = ds.FindAll();
if (src.Count > 1)
{
//Oops too many!
}
else
{
user = src[0].Properties["samAccountName"][0].ToString();
MailAddress = src[0].Properties["Mail"][0].ToString();
}
}

关于c# - 微软交换 : How To Resolve A Distinguished Name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17168066/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com