2
我有一些代碼,retreive目前在Active Directory不同組的用戶。Active Directory中的域用戶無法獲得用戶?
string sADPath = "LDAP://" + tbDomain.Text;
string username = tbUsername.Text;
string password = tbPassword.Text;
DirectorySearcher mySearcher = new DirectorySearcher(directoryEntry);
int MaxResults = Int32.MaxValue - 1;
ComboBoxItem selectItem = (ComboBoxItem)ddlGroups.SelectedItem;
String value = selectItem.Value;
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=User)(memberOf=" + value + "))");
mySearcher.SearchScope = SearchScope.Subtree;
foreach (SearchResult temp in mySearcher.FindAll())
{
}
此代碼工作正常對某些羣體,但不是所有的。
例如,它讓我獲得域管理員的價值,而不是域用戶中的用戶。
它也不會讓我的用戶在Users文件夾組中?
我在FindAll()獲得域值用戶的0值。