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

When you create an Approval Process using SharePoint Designer, the tasks that are created allow the user to edit (Approve, Reject, Reassign, etc) but also allow them to delete the task.

How can you prevent deletion while still allowing the user to edit?

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted
+50

Create a custom permission level for the site based on Contribute, but deselect the delete option. Adjust the permissions of the task list so that the users with Contribute access now use this custom permission level and they should no longer be able to delete items, just read, add, and edit.

share|improve this answer
    
These list permissions don't seem to apply to the task list items created by the SPD workflow. On the List Item itself, the user still has Contribute permissions. –  dhirschl Aug 1 '12 at 16:00
    
You can follow @PirateEric's advice with one tweak. In 2010, you can modify an item's permissions. Simply do a lookup in the workflow, find the newly created task and overwrite the permissions with your own. –  iOnline247 Aug 3 '12 at 16:36
    
@iOnline247 Could you elaborate on "do a lookup in the workflow"? I don't see how I can add an Impersonation Step within an Approval Process, which is the only means I know of altering permissions. –  dhirschl Aug 3 '12 at 20:20
    
I discovered that within SharePoint Designer you need to uncheck the box "Only allow task recipients and process owners to read and edit workflow tasks" in order to inherit permissions from the task list. Otherwise, with this option selected task recipients will get Contribute permissions. –  dhirschl Aug 8 '12 at 15:03
add comment

You can also do the following

Create an event reciever and attach it to the ItemDeleting event of the content type created by the workflow. You would have to use the following code in the event:

properties.Cancel = true; 
properties.Status = SPEventReceiverStatus.Continue; 

Attatching it to the content type created by the workflow means it won't apply to other taks that get created in the Task list which leaves those unaffected. If you make this a site level feature any items created by this workflow won't be deletable(is that even a word)

To find the content type just go to the Task List settings. The items will be using this content type.

You can also just attatch the event reciever to the Tasks Content type therefore not allowing any tasks to be deleted.

Hope that helps!

share|improve this answer
    
you can also do SPEventRecieverStatus.Error and throw back an error like "You cannot delete this task" if you'd like... –  onzur Aug 3 '12 at 20:34
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.