I\'ve been at this for a while and I\'m always getting:
System.DirectoryServices.AccountManagement.PrincipalServerDownException
If you look at the documentation for the PrincipalContext
constructors, it should be quite clear:
public PrincipalContext(ContextType contextType, string name)
or
public PrincipalContext(ContextType contextType, string name, string container)
So you basically need:
ContextType.Domain
)LDAP://
prefix)So try something like this:
PrincipalContext thisPrincipalContext =
new PrincipalContext(ContextType.Domain, "ESTAGIOIT");
or
PrincipalContext thisPrincipalContext =
new PrincipalContext(ContextType.Domain, null); // default domain
or
PrincipalContext thisPrincipalContext =
new PrincipalContext(ContextType.Domain, "ESTAGIOIT", "DC=estagioit,DC=local");
or
PrincipalContext thisPrincipalContext =
new PrincipalContext(ContextType.Domain, null, "CN=Users,DC=estagioit,DC=local");