ActiveDirectoryでユーザー名でユーザーを検索しようとしています。
これは機能します:
const string Domain = "SLO1.Foo.Bar.biz";
const string Username = "sanderso";
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, Domain);
UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(principalContext, Username);
これはしません:
const string Domain = "SLO1.Foo.Bar.biz";
const string Container = "CN=Users,DC=SLO1,DC=Foo,DC=Bar,DC=biz";
const string Username = "sanderso";
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, Domain, Container);
UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(principalContext, Username);
エラーメッセージが表示されます:
サーバー上にそのようなオブジェクトはありません。
これが私のActiveDirectoryセットアップのスクリーンショットです:
また、次のコンテナを使用してみました。
const string Container = "OU=Users,DC=SLO1,DC=Foo,DC=Bar,DC=biz";
これも同様に失敗しました。
'Users'コンテナにアクセスしているときにコンテナを指定するにはどうすればよいですか?より複雑な要件を持つルックアップを導入する前に、これを初期の単純なセットアップとして実行しようとしています。とにかくこれをトラブルシューティングする必要があるので、私は単純な解決策に甘んじたくありません、と私は信じています。