Tuesday, 24 January 2012

Item level security on SharePoint List Programatically


Item level security on SharePoint List Programatically

Properties to set item level security is already in SharePoint object Model. Following is the
SPList have properties to set item level security: SPList.ReadSecurity and SPList.WriteSecurity

E.g.
SPList spList = SPContext.Current.Web.Lists["Vaibhav Blog List"];
spList.ReadSecurity = 2;
spList.WriteSecurity = 4;
spList.Update();

In more, below will help you to understand more:

ReadSecurity
1. SPList.ReadSecurity = 1 stands for Read Access: Specify which items users can read “All items”
2. SPList.ReadSecurity = 2 stands for Read Access: Specify which items users can read “Only their own”
WriteSecurity 
1. SPList.WriteSecurity = 1 stands for Edit access: Specify which items users can edit “All items”
2. SPList.WriteSecurity = 2 stands for Edit access: Specify which items users can edit “Only their own”
3. SPList.WriteSecurity = 4 stands for Edit access: Specify which items users can edit “None”

No comments:

Post a Comment