C# AD通讯组添加用户UnahorizedAccessException
我在AD中有一个通用通讯组。在Exchange中,我将该组设置为公共组,以便任何用户都可以在该组中添加或删除自己 在C#中,我有以下代码:C# AD通讯组添加用户UnahorizedAccessException,c#,active-directory,exchange-server,C#,Active Directory,Exchange Server,我在AD中有一个通用通讯组。在Exchange中,我将该组设置为公共组,以便任何用户都可以在该组中添加或删除自己 在C#中,我有以下代码: PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "Domain.com"); GroupPrincipal group = GroupPrincipal.FindByIdentity(ctx, groupName); UserPrincipal userP = UserPrinc
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()代码>导致取消筛选访问异常
我必须更改什么设置才能允许任何用户执行此操作?事实证明,您必须在AD中的“安全”选项卡上进行更改。您必须在该选项卡下为适当的人员(或域用户,如果您希望每个人都有)授予适当的权限