G
greg.hart
Hello all,
I am using the code below to query data from AD. Everything working
well, but I wanted to get some additional data like: title, dept,
pager, etc. These don't seem to appear as properties of
UserPrincipal. Is it possible to retrieve them or do I need to use
the DirectorySearcher class from the 2.0 framework to retrieve these
values.
Thanks.
PrincipalContext ctx = new PrincipalContext(ContextType.Domain,
<Domain>,<UserName>,<Password>);
UserPrincipal u = new UserPrincipal(ctx);
u.Enabled = true;
u.Name = "*";
u.VoiceTelephoneNumber = "*";
PrincipalSearcher ps = new PrincipalSearcher(u);
PrincipalSearchResult<Principal> fr = ps.FindAll();
foreach (UserPrincipal usr in fr)
{
Response.Write(usr.DisplayName + " " +
usr.VoiceTelephoneNumber + "<br />");
}
I am using the code below to query data from AD. Everything working
well, but I wanted to get some additional data like: title, dept,
pager, etc. These don't seem to appear as properties of
UserPrincipal. Is it possible to retrieve them or do I need to use
the DirectorySearcher class from the 2.0 framework to retrieve these
values.
Thanks.
PrincipalContext ctx = new PrincipalContext(ContextType.Domain,
<Domain>,<UserName>,<Password>);
UserPrincipal u = new UserPrincipal(ctx);
u.Enabled = true;
u.Name = "*";
u.VoiceTelephoneNumber = "*";
PrincipalSearcher ps = new PrincipalSearcher(u);
PrincipalSearchResult<Principal> fr = ps.FindAll();
foreach (UserPrincipal usr in fr)
{
Response.Write(usr.DisplayName + " " +
usr.VoiceTelephoneNumber + "<br />");
}