Exchange邮箱DirectoryEntry属性列表

时间:2014-11-21 15:51:01

标签: c# exchange-server

您能否告诉我它是否存在Exchange邮箱对象的DirectoryEntry属性列表?

这是我的代码示例:

// create your domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, ConfigurationManager.AppSettings["ADDomain"].ToString(), ConfigurationManager.AppSettings["ADUser"].ToString(), ConfigurationManager.AppSettings["ADPassword"].ToString());

// define a "query-by-example" principal - here, we search for all users
UserPrincipalEXT qbeUser = new UserPrincipalEXT(ctx);

// create your principal searcher passing in the QBE principal    
PrincipalSearcher srch = new PrincipalSearcher(qbeUser);

// find all matches
foreach (var found in srch.FindAll())
{  
    if (found.GetUnderlyingObjectType() == typeof(DirectoryEntry))
    {
        DirectoryEntry de = (DirectoryEntry)found.GetUnderlyingObject();
    }                 
}

我正在努力寻找我需要的物业名称......

谢谢!

1 个答案:

答案 0 :(得分:1)

DirectoryEntry.Properties的类型为PropertyCollection。这会公开可用于枚举属性的PropertyNames等属性。

foreach (var name in de.Properties.PropertyNames)
{
    Console.WriteLine(name);
}