- Start Microsoft Visual Studio 2010.
- On the File menu, point to New, and then click Project.
- In Project Types, under Visual Basic or C#, select Event Receiver.
- Type DeletingEventReceiver as the project name. Click OK.
- In the SharePoint Customization Wizard, choose Deploy as a sandboxed solution. Click Next.
- In the Choose Event Receiver Settings dialog, select List Item Events in the What type of event receiver do you want? dropdown.
- In the What item should be the event source? dropdown, choose Tasks.
- Choose the An item is being deleted option in the Handle the following events list. Click Finish.
- In the EventReceiver1 file that is created, insert the following code in the ItemDeleting method.
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "Deleting items from " +
properties.RelativeWebUrl + " is not supported.";
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......