Using the SharePoint Security Object Model

SharePoint enables you to do everything that you can do in security through the user interface also through the SharePoint object model. Table 17.1 lists the various classes and objects related to security.

Table 17.1. Class and Objects for SharePoint Security Object Model

Image

The following code illustrates creation of a new permission level:

// create a new permission levelSPRoleDefinition roleDefinition = new SPRoleDefinition();// assign some permissions to the new permission levelroleDefinition.BasePermissions =SPBasePermissions.AddListItems |SPBasePermissions.BrowseDirectories |SPBasePermissions.DeleteListItems ...

Get Sams Teach Yourself SharePoint® 2010 Development in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.