我可能只是愚蠢,但我正在尝试使用登录名("域\用户")从C#中找到Active Directory中的用户.
我的"Skeleton"AD搜索功能通常如下所示:
de = new DirectoryEntry(string.Format("LDAP://{0}", ADSearchBase), null, null, AuthenticationTypes.Secure);
ds = new DirectorySearcher(de);
ds.SearchScope = SearchScope.Subtree;
ds.PropertiesToLoad.Add("directReports");
ds.PageSize = 10;
ds.ServerPageTimeLimit = TimeSpan.FromSeconds(2);
SearchResult sr = ds.FindOne();
Run Code Online (Sandbox Code Playgroud)
现在,如果我有用户的完整DN(ADSearchBase通常指向Active Directory中的"我们的用户"OU),那就有效,但我根本不知道如何根据"domain\user"语法查找用户.
任何指针?