简体   繁体   中英

Prevent deletion of Attachments from a SharePoint List Item

We have a custom SharePoint list type . Part of our list's functionality depends on the existence of a specific attachment for each list item. When the user accidentally or intentionally deletes the attachment (named DoNotDelete.fi!) of a list item our functionality for that item is broken . Therefore we would like to prevent user from being able to delete that particular list item attachment (but should be able to edit the list item otherwise).

Can this be achieved through the use of an EventReceiver for this list item ? Given that the attachments are stored in the RootFolder of the list, maybe the EventReceiver needs to be attached not to the list item but elsewhere?

Yes, it is possible, I have created such a construction once.

You have to implement the ItemAttachmentDeleting method of an SPItemEventReceiver . See all possible methods here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventreceiver_members.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM