I have the below code to get a user's full name by logon name:
public View GetUser(string sUser)
{
View oView = new View();
oView.User = sUser.ToUpper();
using (PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, "varner.no"))
{
UserPrincipal oUserPrincipal = UserPrincipal.FindByIdentity(oPrincipalContext, oView.User);
oView.Name = oUserPrincipal.DisplayName;
return oView;
}
}
}
But what I also need is to get other attributes from this code. In this case I need the "ipPhone" attribute from ad. Is this possible or do I need to use DirectorySearcher from DirectoryEntry?