Sunday, July 28, 2013

Restrict user to delete a Item/document from List or Library in SharePoint 2010

We can restrict user from deleting a Item or Document from List or Document Library.Here are few steps...

   1- Remove delete rights from List or Library and assign user only Add/Edit Permission...

  • Go to Site Action > Site PermissionsPermission Levels
  • Add  a Permission Level > Enter Permission Level name > Select AddItems, EditItems, ViewItems from List Permissions then click create.

  •      Now select your Document Library > Library Permissions 
  •      Stop Inheriting Permissions > Remove User Permissions > Grant Permissions > then enter user name in User/Groups box then click ok.

Now LogIn to SharePoint site using this user and  go to the library and select a document and click on delete

    Do same steps for SharePoint list.

   2- Create a Event Receiver on SharePoint List/Library to restrict user to delete a document or List Item...
     public override void ItemDeleting(SPItemEventProperties properties)
           if (properties.List.Title == "YourListName")
             properties.Cancel = true
             properties.ErrorMessage = "Can not delete list item.";
      Now try to delete a Item from list, below error window will be dispaly...



No comments:

Post a Comment

SharePoint Deployment Error : The specified path, file name, or both are too long.

Hi, Sometimes we get surprised with below error while deploying wsp file... Solution : To overcome with this issue, we just ne...