我在 AD 中有一个通用分发组。在 Exchange 中,我将组设置为公开的,以便任何用户都可以在组中添加或删除自己。
在 C# 中,我有以下代码:
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "Domain.com");
GroupPrincipal group = GroupPrincipal.FindByIdentity(ctx, groupName);
UserPrincipal userP = UserPrincipal.FindByIdentity(ctx, User.Identity.Name);
group.Members.Add(userP);
group.Save();
group.Save();
原因_ UnathorizedAccessException
_
我必须更改什么设置才能允许任何用户执行此操作?