2013-09-27 71 views
0

我在AD中拥有通用通讯组。在Exchange中,我将该组设置为公开,以便任何用户都可以在组中添加或删除自己。AD通讯组添加用户UnathorizedAccessException

在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

我必须更改哪些设置以允许任何用户执行此操作?

回答

0

事实证明,您必须对AD中的安全选项卡进行更改。您必须为适当的人员(或域用户,如果您希望每个人)提供该选项卡下的适当权限。