Forum Discussion
Why delete permission is required to rename a document in SP Document Library?
- Feb 15, 2017
Yeah, with a standard Contribute level sans Delete, the permissions mask isn't going to match what SharePoint is requesting to rename an item (0x28 or DeleteListItems + OpenItems). This is identical to what would occur on a file system over CIFS or local (NTFS); the operation is not a 'rename', but rather a move operation. A move, of course, requires the ability to delete the source file once the move has been confirmed.
And as noted in the article, SharePoint acts similar to a file system, hence acting like an Windows Explorer move operation.
Yes there is a work around to solve this problem which I've done already,
you can simply add the following javaScript to watch DOM changes in your master page, to remove delete option for (document, folder, workflow, etc...) .
I wrote this code to remove "delete" and also to deactivate delete action from Keyboard if document was selected and"delete" button was pressed, without disabling delete button from being used in the web page (ex. text boxes, text areas, etc..), and this can be done by overriding confirmation method "window.confirm".
The attached screen shots shows the output after editing master page and publishing.
You can add the following script directly under the <body> tag in your master page html.
<script type="text/javascript">//<![CDATA[
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var objDelete = document.getElementById("ID_DeleteDocItem") || false;
var objDeleteItem = document.getElementById("ctl00_PlaceHolderMain_ctl00_ctl00_toolBarTbl_RptControls_diidIODeleteItem_LinkText") || false;
var objDeleteVersions = document.getElementById("ctl00_PlaceHolderMain_MngVersionToolBar_RptControls_diidDeleteVersions_LinkText") || false;
var objDeleteItem2 = document.getElementById("ID_DeleteItem") || false;
var objDeleteUserFromSCollection = document.getElementById("ctl00_PlaceHolderMain_UserListForm_ctl00_ctl00_ctl00_toolBarTbl_RptControls_diidIODeleteItem_LinkText") || false;
if(objDelete){
var firstParent = objDelete.parentNode;
firstParent.parentNode.removeChild(firstParent);
}
if(objDeleteItem) {
var firstParent = objDeleteItem.parentNode;
firstParent.parentNode.removeChild(firstParent);
}
if(objDeleteItem2) {
var firstParent = objDeleteItem2.parentNode;
firstParent.parentNode.removeChild(firstParent);
}
if(objDeleteVersions){
var firstParent = objDeleteVersions.parentNode;
firstParent.parentNode.removeChild(firstParent);
}
if(objDeleteUserFromSCollection) {
var firstParent = objDeleteUserFromSCollection.parentNode;
firstParent.parentNode.removeChild(firstParent);
}
});
});
mutationObserver.observe(document.documentElement, {
attributes: true,
characterData: true,
childList: true,
subtree: true,
attributeOldValue: true,
characterDataOldValue: true
});
window.confirm = function(message) {
if(message.indexOf("Recycle Bin?") != -1){
return false;
} else {
var responseConfirm = prompt(message, "Confirm");
if (responseConfirm != null) {
return true;
} else {
return false;
}
}
};
//]]>
</script>