本文介绍了OnlyAllowMembersViewMembership = false不保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在网站配置类中创建5个组,所有这些都可以正常工作.但是,我想让所有人都可以看到组成员,因此我设置OnlyAllowMembersViewMembership = false,但是当我在sharepoint中查看组设置时,所有组的最终值都等于true.有任何想法吗?

私人

I have to create 5 groups in my site provisioning class and all that is working fine.  however, I'm suppose to allow everyone to see the group members so I set OnlyAllowMembersViewMembership = false but all the groups end up with the value equal to true when I view the group settings in sharepoint.  Any ideas?

private

void CreateGroup( SPWeb 网站, 字符串 groupName, SPUser groupOwner, 字符串 权限, 布尔 removeGroupOwner, 字符串 说明)
{
site.SiteGroups.Add(groupName,groupOwner,groupOwner,description);

void CreateGroup(SPWeb site, string groupName, SPUser groupOwner, string permission, bool removeGroupOwner, string description)
{
site.SiteGroups.Add(groupName, groupOwner, groupOwner, description);

 

如果 (removeGroupOwner)
网站. SiteGroups [groupName] .RemoveUser(groupOwner);

site.AssociatedGroups.Add(site.SiteGroups [groupName]);
site.SiteGroups [groupName] .Description = description;
site.SiteGroups [groupName] .OnlyAllowMembersViewMembership =
false ;
site.SiteGroups [groupName] .Update();

if (removeGroupOwner)
site.SiteGroups[groupName].RemoveUser(groupOwner);

site.AssociatedGroups.Add(site.SiteGroups[groupName]);
site.SiteGroups[groupName].Description = description;
site.SiteGroups[groupName].OnlyAllowMembersViewMembership =
false;
site.SiteGroups[groupName].Update();

 

SPGroup group = site.SiteGroups [groupName];
SPRoleAssignment groupRoleAssigment = SPRoleAssignment (组);
SPRoleDefinition groupRoleDefinition = site.RoleDefinitions [permission];
groupRoleAssigment.RoleDefinitionBindings.Add (groupRoleDefinition);
site.SiteGroups [groupName] .Update();
site.RoleAssignments.Add(groupRoleAssigment);
site.Update();

}

SPGroup group = site.SiteGroups[groupName];
SPRoleAssignment groupRoleAssigment = new SPRoleAssignment(group);
SPRoleDefinition groupRoleDefinition = site.RoleDefinitions[permission];
groupRoleAssigment.RoleDefinitionBindings.Add(groupRoleDefinition);
site.SiteGroups[groupName].Update();
site.RoleAssignments.Add(groupRoleAssigment);
site.Update();

}

推荐答案


这篇关于OnlyAllowMembersViewMembership = false不保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 06:46