Vinc 웃
Vinc 웃

Reputation: 1247

Exchange mailbox DirectoryEntry properties list

Can you tell me if it exist a list of the DirectoryEntry properties for an exchange Mailbox object ?

Here's the sample of my code :

// 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();
    }                 
}

I am struggling to find the name of the properties I need...

Thank you !

Upvotes: 0

Views: 240

Answers (1)

itsme86
itsme86

Reputation: 19486

DirectoryEntry.Properties is of type PropertyCollection. This exposes properties like PropertyNames that you can use to enumerate properties.

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

Upvotes: 1

Related Questions