Şu anda bu kodu var Active Directory Listesi OU adlı
string defaultNamingContext;
DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE");
defaultNamingContext = rootDSE.Properties["defaultNamingContext"].Value.ToString();
rootDSE = new DirectoryEntry("LDAP://" + defaultNamingContext);
//DirectoryEntry domain = new DirectoryEntry((string)"LDAP://" + defaultNamingContext);
DirectorySearcher ouSearch = new DirectorySearcher(rootDSE,"(objectCategory=Organizational-Unit)",
null, SearchScope.Subtree);
MessageBox.Show(rootDSE.Path.ToString());
try
{
SearchResultCollection collectedResult = ouSearch.FindAll();
foreach (SearchResult temp in collectedResult)
{
comboBox1.Items.Add(temp.Properties["name"][0]);
DirectoryEntry ou = temp.GetDirectoryEntry();
}
}
i bu durumda DC=g-t-p,DC=Local
yılında, o rootDSE.Path doğru yere infact işaret olduğunu görebilirsiniz ancak dizin arama kokan debugger kullanımı
OMG şey görmüyorum deneme ve hata kodlama saatleri: @ Son zamanlarda en üretken olduğunu sanmıyorum ... –
Arama nesnelerini Combo kutu öğelerine eklemek için doğru şekilde topluyor gibi görünüyor mu? –
+1 Kendimi test ettim ve cevabımı yazmak üzereyken, aynı kesin sonuca vardım. –