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
properties.ListItem.Properties["ForbidDeleting"].ToString().Equals("true")
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.
