Translate

Sunday, September 16, 2012

Using ReadSecurity and WriteSecurity members in SharePoint

Using ReadSecurity and WriteSecurity members in SharePoint

ReadSecurity and WriteSecurity

ReadSecurity
Using the ReadSecurity we can specify the list permission as read only access to list created through programmatically, it will restrict the users for modifications to the items which they are not owners of that items.
WriteSecurity
Using  WriteSecurity we can allow the users to do modifications to list items which they are owners of the items when we create the list by using the SharePoint Object Model programmatically.
Sample demo code explains about the ReadSecurity  and WriteSecurity by creating reimbursement expense list in which employee who wants to claim their expanses will have the permission which they item and others will not have an access ,Creating it through console application.
//Create the SPSite by passing the url
Using(SPSite spSite=new SPSite(“http://demo/sites/HR”);
{
//Create new GUID
Guid  newListGuid=spWeb.Lists.Add(“ExpensesReimbursement”,” Expenses Reimbursement List”,SPListTemplateType. GenericList );
//open  site

Using (SPWeb spWeb=spSite.OpenWeb())
{
//Create new SPList by passing new GUID
SPList newInstanceList  =  spWeb.Lists[newListGuid];
}
}

No comments:

Post a Comment