CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Active Directory
C#
public bool IsADUsernameExistsAndNotDisabled(string userName)
    {
        DirectoryEntry searchRoot = new DirectoryEntry(ldapConnection, eCrewUserName, eCrewUserPassword);
  
        DirectoryEntry searchRoot = new DirectoryEntry("LDAP://999.999.999.999/DC=CompanyDomain, DC=com", "ADUserAdmin", "AdUserAdminPassword");
        DirectorySearcher searchForUser = new DirectorySearcher(searchRoot);
 
        searchForUser.SearchScope = SearchScope.Subtree;
        //searchForUser.Filter = string.Format("(&(objectCategory=Person)(anr={0}))", userName);
        //searchForUser.Filter = string.Format("(&(objectCategory=Person)(anr={0})(userAccountControl:1.2.840.113556.1.4.803:=2))", userName);
by nobodybutca   October 04, 2009 @ 7:40pm
208 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate