AD ユーザーのグループを取得しようとしています。ユーザーはhq.example.company.com/Deep/Usersにあり、Deep と Users は組織単位です。グループはhq.example.company.com/Deep/Groupsにあります。
これが私のコードです:
var domain = new PrincipalContext(ContextType.Domain,
"hq.example.company.com", "dc=hq,dc=example,dc=company,dc=com");
UserPrincipal user = UserPrincipal.FindByIdentity(domain, "user");
PrincipalSearchResult<Principal> groups = user.GetGroups();
foreach (var p in groups)
{
Console.WriteLine("Name: {0}", p.Name);
}
「グループ」変数には、「ドメイン ユーザー」グループと hq.example.company.com/Deep/Groups からのいくつかのカスタム グループが含まれます。「Domain users」グループの名前はエラーなしで出力されますが、他のグループは 「指定されたディレクトリ サービスの属性または値が存在しません」というエラーをスローします。誰かが私が間違っていることを知っていますか?