몇 시간 동안 내 머리를 부딪혀이 왜 작동하지 않는지 알아 내려고 노력했습니다. 광고 그룹에서 사용자 목록을 가져 오는 예를 발견했지만 제대로 작동하지 않습니다. 여기에 내가 할 노력했습니다 무엇 :Active Directory 그룹에서 사용자 가져 오기
DirectoryEntry de = new DirectoryEntry("LDAP://DC=" + domain + ",DC=com");
DirectorySearcher ds = new DirectorySearcher(de);//, "(objectClass=person)");
ds.Filter = "(&(objectCategory=person)(objectclass=user)(memberOf=CN=!CityNameGroup))";
ds.PropertiesToLoad.Add("givenname");
ds.PropertiesToLoad.Add("samaccountname");
ds.PropertiesToLoad.Add("sn");
ds.PropertiesToLoad.Add("useraccountcontrol");
foreach (SearchResult sr in ds.FindAll())
{//stuff goes here}
하지만 ds.FindAll
항상 다시이 필터와 0 결과를 제공합니다. 나는 결과를 가져 오는 간단한 필터를 할 수 있지만, 위의 필터로부터 어떤 것도 얻지 못한다. CityNameGroup!에있는 모든 사용자를 원할뿐입니다. 도움에 감사드립니다!
당신은 락! 감사합니다 :) – adminJaxon
항상 도와 줘서 기뻐! –