Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
2008-01-17 09:59
666 查看
Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
Create a permission level
If there is no permission level similar to the one you need, you can create one and include just the permissions that you need.
1:On the Site Settings page, under Users and Permissions, click Advanced permissions.
2:On the toolbar, click Settings, and then click Permission Levels.
3:On the toolbar, click Add a Permission Level.
4:On the Add a Permission Level page, in the Name box, type a name for the new permission level..
5:In the Description box, type a description for the new permission level..
6:In the list of permissions, select the check boxes to add permissions to the permission level
7:Click Create.
这个例子是新建一个 permission level,名字为Example_xxxxxxxxxxx.建好之后.绑定这个permission level 到一个已经存在的组名字为Foo.另一种是不写代码直接在网站上添加的方法
using (SPSite site = new SPSite( "http://moss/sites/PermExample" ))
{
using (SPWeb rootWeb = site.RootWeb)
{
string permissionLevelName = "Example_"+System.DateTime.Now.Ticks.ToString();
// Create a new Permission Level
SPRoleDefinition newPermissionLevel = new SPRoleDefinition();
newPermissionLevel.Name = permissionLevelName;
newPermissionLevel.Description = "Example Permission Level";
newPermissionLevel.BasePermissions =
SPBasePermissions.AddListItems |
SPBasePermissions.BrowseDirectories |
SPBasePermissions.EditListItems |
SPBasePermissions.DeleteListItems |
SPBasePermissions.AddDelPrivateWebParts;
// Add the permission level to web
rootWeb.RoleDefinitions.Add(newPermissionLevel);
// Bind to the permission level we just added
newPermissionLevel = rootWeb.RoleDefinitions[permissionLevelName];
// Create a new role Assignment using the SharePoint Group "Foo"
SPRoleAssignment roleAssignment = new SPRoleAssignment( (SPPrincipal)rootWeb.SiteGroups[ "Foo" ] );
// Add the Permission Level to the Foo SharePoint Group
roleAssignment.RoleDefinitionBindings.Add(newPermissionLevel);
// Add the new Role Assignment to the web
rootWeb.RoleAssignments.Add(roleAssignment);
rootWeb.Close();
}
site.Close();
}
这样就新建成功了.也绑定到了已经存在的组.!
Create a permission level
If there is no permission level similar to the one you need, you can create one and include just the permissions that you need.
1:On the Site Settings page, under Users and Permissions, click Advanced permissions.
2:On the toolbar, click Settings, and then click Permission Levels.
3:On the toolbar, click Add a Permission Level.
4:On the Add a Permission Level page, in the Name box, type a name for the new permission level..
5:In the Description box, type a description for the new permission level..
6:In the list of permissions, select the check boxes to add permissions to the permission level
7:Click Create.
相关文章推荐
- Create a New SharePoint Permission Level and Bind it to an Existing SharePoint Group
- How to create your own custom 404 error page and handle redirect in SharePoint
- setup was unable to create a new system partition or locate an existing system
- 创建团队项目时,遭遇:Insufficient permissions on the Windows SharePoint Services at 123.12.15.25 to create a new site.错误!
- 安装Windows Server 2012 R2提示"unable to create a new system partition or locate an existing system partition"解决方法
- 转:SharePoint Workflow and when to use it…
- Alias "bootstrap.widgets.TbHeroUnit" is invalid. Make sure it points to an existing PHP file and the
- Magento. How to create an attribute and apply it to products
- 【转】How to install and configure SharePoint Server 2010 SP1 on the existing SP 2010 Farm
- SharePoint Solution Generator - part 1: create a site definition from an existing site
- C# pdf 缩放纸型-iTextSharp - read an existing pdf, resize it and then draw it on a new one
- windows 8安装,选择盘符时“Setup was unable to create a new system partition or locate an existing system partition.”
- How to create a project from existing source in Eclipse and then find it?
- How To Create SharePoint 2010 Site Collection In Its Own DB
- An unexpected error has occurred" error appears when you try to create a SharePoint Enterprise Search Center on a Site Collection
- How to set Item Level Permission for SharePoint 2007 (MOSS/WSS) List/Document Library Programmatically
- How to add a new user in linux and add it to a new group
- How to set value for webpart’s properties when I create a new sharepoint template
- Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's)
- 转:How to create your own custom 404 error page and handle redirect in SharePoint 2007 (MOSS)?