2

I have two questions here. The first question is that I need to allow users to add documents, edit them but not delete them. I know that this is possible somehow by writing a code using the ItemDeleting event handler. However I do not know what code would be required..

The second question is, obviously it seems that you can write codes to a SharePoint site. What I have not known is where I can write these codes? I have Visual Studio with the SharePoint extension installed. Where in the SharePoint online settings can I add or delete code?

Thanks for the help in advance!

2 Answers 2

1

You don't have to write code to achieve this, just custom the permisson level in https://tenant.sharepoint.com/sites/yoursite/_layouts/15/user.aspx to achieve this.

enter image description here

In the custom permissin level, make sure you uncheck the option "Delete Item". Like this:

enter image description here

2
0

You need to create a custom permission level based on default Contribute permission level in SharePoint.

In custom permission level, you can uncheck delete permissions from list.

Check below links for steps in details:

  1. SharePoint Online: How to Set Permissions to Add But Not Delete
  2. SharePoint online site permissions add but not delete

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.