Premise, it is first time I work with Active Directory (my project is a web app in Asp.Net MVC).
For a User in Active Directory I need to read an attribute givenName in my C#.
My questions:
-
Using Active Directory Browser on Windows Server I cannot see
givenNameattribute for a user. Can this attribute be hidden from the view in Active Directory? -
Could you provide me a sample of code which allow me to take the
givenNameattribute knowing the UserName for the user?
If you’re on .NET 3.5 and up, you should check out the
System.DirectoryServices.AccountManagement(S.DS.AM) namespace. Read all about it here:Basically, you can define a domain context and easily find users and/or groups in AD:
The new S.DS.AM makes it really easy to play around with users and groups in AD!