I have a list with requests. This list is monitored by BizzTalk and synced with an external system.
In the list is a status column, which is hidden on the editing/new form, in which the status of the request is stored ('Pending', 'Accepted', ' Denied', 'Cancelled').
The user who file request must be able to alter and delete requests. When a request is new/updated I can set the status to 'Pending' using the
I would like to archive the same when a user tries to delete a request (using the
itemDeleting event). The request shouldn't be deleted but has its status changed to 'Cancelled'.
How do I set a property in the deleting event and at the same time cancel the deletion of the item?
properties.Cancel = true; properties.Status = SPEventReceiverStatus.Continue; properties.AfterProperties["GE_AO_Status"] = "Vervallen";
That results in an error that the
afterproperties can't be changed in this event.
(using MOSS SP2)
edit I changed my code to (thanks Gomiunik and Cimares):
SPListItem item = properties.ListItem; item["GE_AO_Status"] = "Vervallen"; item.Update();
and it works. Both answer have more complicated ways of getting the ListItem, why?