I am new to SharePoint, sorry if answer to my question is obvious.

I want to forbid deleting some tasks for users. I can use event receiver for my purpose:

public override void ItemDeleting(SPItemEventProperties properties)
    if (...) 
        properties.ErrorMessage = "The task can not be deleted";
        properties.Cancel = true;

But I can't pass data for checking if I can delete the task. I've tryed to use


in the receiver's condition but is there any posibility to set such property in the CreateTask invoking method? I've tryed using Extended properties for it, but this approach doesn't work.

 task.ExtendedProperties["ForbidDeleting"] = "true"

I can create my class for keeping task Guids and it ForbidDeleting property, but I think it is not a solution but workaround.

Could you help me please? How can I set some task properties (in the CreateTask invoking method) and get it in the event receiver. Is there any built in way to do it?

Thank you in advance.

PS: Sorry for my writing. English is not my native language.

1 Answer 1


How do you retrieve Extended Properties? I used this code in my castom form in the past. I think it should work in event receiver.

Hashtable extendedProperties = SPWorkflowTask.GetExtendedPropertiesAsHashtable(taskItem);
var value = extendedProperties[key].ToString();
  • Yes. It's really works!
    – MikhailSP
    Commented Mar 26, 2012 at 6:57

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.