In my ASP.NET application, I get information from Active Directory. I should get user information with GUID information (example: a28a6a34dsfdsf57d9e54f945a241), but I donβt know how I can use the filter for this search: /
for example, if I search for a username:
DirectoryEntry Entry = new DirectoryEntry("LDAP://" + "Domain"); string filter = "(&(objectClass=user)(objectCategory=person)(cn=" + txtBenutzer.Text + "*))"; DirectorySearcher Searcher = new DirectorySearcher(Entry, filter); var q = from s in Searcher.FindAll().OfType<SearchResult>() select new { //GetProperty(s, "objectGUID"), Benutzer = GetProperty(s, "sAMAccountName"), eMail = GetProperty(s, "mail"), Vorname = GetProperty(s, "givenName"), Nachname = GetProperty(s, "sn"), Telefon = GetProperty(s, "telephoneNumber"), UserID = s.GetDirectoryEntry().NativeGuid }; this.myListView.DataSource = q; this.myListView.DataBind();
now I need a filter with a GUID that I can find only one user in AD. GUID for this search I have the string UserID = Session ["UserID"]. Tostring ()
Tarasov
Tarasov
source share