コンソールアプリケーションからXXXドメインのディレクトリにアクセスしようとしています。
DirectoryEntry oDE = new DirectoryEntry("LDAP://DC=XXXX,DC=myDomain,DC=com");
using (DirectorySearcher ds = new DirectorySearcher(oDE))
{
ds.PropertiesToLoad.Add("name");
ds.PropertiesToLoad.Add("userPrincipalName");
ds.Filter = "(&(objectClass=user))";
SearchResultCollection results = ds.FindAll();
foreach (SearchResult result in results)
{
Console.WriteLine("{0} - {1}",
result.Properties["name"][0].ToString(),
result.Properties["userPrincipalName"][0].ToString());
}
}
行SearchResultCollectionresults= ds.FindAll();の場合 実行すると、「サーバーにそのようなオブジェクトはありません」というエラーが表示されます。
私が間違っていることは何ですか?