本文整理汇总了C#中SPWeb.CreateNewGroup方法的典型用法代码示例。如果您正苦于以下问题:C# SPWeb.CreateNewGroup方法的具体用法?C# SPWeb.CreateNewGroup怎么用?C# SPWeb.CreateNewGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPWeb
的用法示例。
在下文中一共展示了SPWeb.CreateNewGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetRootSitePermissions
private void SetRootSitePermissions(SPWeb web)
{
try
{
string groupOwners = web.Title.Trim() + " Owners";
web.CreateNewGroup(groupOwners, "Use this group to grant people full control permissions to the SharePoint site: " + web.Title.Trim(), SPRoleType.Administrator);
string groupMembers = web.Title.Trim() + " Members";
web.CreateNewGroup(groupMembers, "Use this group to grant people contribute permissions to the SharePoint site: " + web.Title.Trim(), SPRoleType.Contributor);
string groupVisitors = web.Title.Trim() + " Visitors";
web.CreateNewGroup(groupVisitors, "Use this group to grant people read permissions to the SharePoint site: " + web.Title.Trim(), SPRoleType.Reader);
web.Update();
Utility.ChangeSPGroupOwnerBySPGroup(web, groupOwners, groupOwners);
Utility.ChangeSPGroupOwnerBySPGroup(web, groupMembers, groupOwners);
Utility.ChangeSPGroupOwnerBySPGroup(web, groupVisitors, groupOwners);
SPUser authenUsers = web.EnsureUser("NT AUTHORITY\\authenticated users");
if (authenUsers != null)
{
SPGroup spGrp = web.Groups[groupVisitors];
if (spGrp != null)
{
spGrp.AddUser(authenUsers);
}
}
}
catch (Exception ex)
{
Utility.LogError(ex.Message, AIAPortalFeatures.Infrastructure);
}
}