Simon
3. Validate if a user exists /// /// Method to validate if a user exists in the AD. /// /// /// public bool UserExists(string UserName){ DirectoryEntry de = ADHelper.GetDirectoryEntry(); DirectorySearcher deSearch = new DirectorySearcher(); deSearch.SearchRoot =de; deSearch.Filter = "(&(objectClass=user) (cn=" + UserName +"))"; SearchResultCollection results = deSearch.FindAll(); if(results.Count == 0){ return false; } else{ return true; } }
In the Code is a Class ADHelper, but this Class dosen't exist. Is this Example not finished or what is the problem? I really need this Script. I have a Project in my company. To say is, that i'm a Noobie. My question is maybe stupid, but i hope you can help me?
Thank you very much!! Greetz Simon