I can successfully pull out fields from an AD account but unable to get the 'department' field using System.DirectoryServices.A
gement for framework 3.5.
The object 'user' that's returned by UserPrincipal does not seem to have a property for this or one that I cannot find. Anyone have a solution instead of using the old System.DirectoryServices model?
PrincipalContext adPrincipalContext = new PrincipalContext(ContextType.Domain, "MyDomain", "DC=MyDomain,DC=com,DC=au");
UserPrincipal user = UserPrincipal.FindByIdentity(adPrincipalContext, IdentityType.SamAccountName, "aduser");
lblInfo.Text = "<br>" + user.DisplayName.ToString();
lblInfo.Text += "<br>" + user.EmailAddress.ToString();