Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

one of our customers sent us a requirement where their users must be able to "Upload/Add" documents, but can't delete those or any other documents. However, at the same time, the user must be able to "Move" those documents into folders (pre-existing ones).

To be clear, the move operation is done by some code that we wrote (to handle "move" and metadata change at the same time, I won't go into details since they don't add anything to this question). To perform the move operation we use

SPListItem.File.MoveTo(folderUrl);

Which works if the user have permission to "Delete" files, but doesn't work if we get rid of that setting.

Without using Elevated privileges, does anybody knows if there is a way to temporarily give "Delete" permission and remove it right away (after the move operation)? Or is there any other approach to do want I'm asking?

Thanks in advance

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

How about if you implement a custom action entitled 'Move' against a document item.

When the user clicks Move then the custom page that is triggered runs as the SharePoint system (through run with elevated privileges) and moves the document appropriately.

share|improve this answer
    
This wasn't exactly what I did, but was the closest one. The custom move operation was already built, so I just needed elevated privileges on the SPListItem it self, AllowUnsafeUpdates on the item SPWeb and finally call SP MoveTo() –  João Gala Louros Oct 15 '12 at 18:54
add comment

You could have the code temporarily implement item level security on the item being moved and grant the user delete permissions for the duration of the move. Naturally, you would have to pull that permission back off once it had been moved and re-inherit security on the item. Otherwise, you would quickly hit the SharePoint ACL boundary.

share|improve this answer
add comment

How about leaving them the Delete permission (IE - normal Contribute), but setting up an ItemDeleting event receiver on that list which aborts the action for non-authorized users?

SPFile.MoveTo() does not trigger ItemDeleting or ItemDeleted, by the way.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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