Mondyak Mondyak - 5 months ago 47
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?


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