Wie bekomme ich die Active Directory-Benutzer-Eigenschaften mit System.DirectoryServices.Kontoverwaltung-Namespace?

Will ich tun, um Active Directory-Eigenschaften von einem user und ich will System.DirectoryServices.AccountManagement.

mein code:

public static void GetUserProperties(string dc,string user) 
        {
            PrincipalContext ctx = new PrincipalContext(ContextType.Domain, dc);
            UserPrincipal u = UserPrincipal.FindByIdentity(ctx, user);

            string firstname = u.GivenName;
            string lastname = u.Surname;
            string email = u.EmailAddress;
            string telephone = u.VoiceTelephoneNumber;

            ...//how I can get company and other properties?
        }
Was meinst du Firma?
möglich dup stackoverflow.com/questions/1785751/...
würde ich auch brauchen, ohne dabei gleich mit extension-Methoden für eine einfachere Lösung.

InformationsquelleAutor Tarasov | 2013-01-11

Schreibe einen Kommentar