Mondyak Mondyak - 1 year ago 188
C# Question

How to get Active Directory Attributes not represented by the UserPrincipal class

What I mean is that right now I am using System.DirectoryServices.AccountManagement and if I use UserPrincipal class I only see the Name, Middle Name, etc

so in my codes it like

UserPrincipal myUser = new UserPrincipal(pc);
myUser.Name = "aaaaaa";
myUser.SamAccountName = "aaaaaaa";

How would I see the attribute like mobile or info?

Answer Source

The proper way of doing it is by using PrincipalExtensions where you Extend the Principal you are after and use the methods ExtensionSet and ExtensionGet as explained here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download