I have this requirement, using WSS 3.0, that when an attachment is added or deleted from a list item, I need to send an email to the users. I'm not having a problem with the emails; it's understanding how the following events work. I'm using the following 4 events:

ItemAttachmentAdding, ItemAttachmentAdded, ItemAttachmentDeleting, ItemAttachmnetDeleted

If I add 2 attachments to an item, I get ItemAttachmentAdding and ItemAttachmentAdded fired for each attachment, which is what I expect. But when I delete 2 attachments, I get ItemAttachmentDeleting and ItemAttachmentDeleted fired only once total (for both files). I expect this to behave like the Adding/Added events; both events for each file deleted. And unlike the Adding/Added events, I don't have access to the name of the attachments that were deleted. Seems inconsistent.

Is this the correct behavior for these events? And is there a way to identify the names of the attachments that were deleted?

1 Answer 1


I've quickly checked on 2010 version - there's the SPItemEventProperties.BeforeUrl property (and corresponding SPItemEventProperties.AfterUrl property). On ItemAttachmentDeleting event SPItemEventProperties.BeforeUrl contains the url of the targeted attachment. I hope it works similar in 2007 version.

Unfortunately in the 2010 version ItemAttachmentDeleting event is being fired once for each attachment.

  • Thank you Alex. On the AttachmentDelete/Deleting events, I'm seeing BeforeUrl as null. On the AttachmentAdded/Adding events, BeforeUrl does contain the filename. Either 3.0 is screwed up or it's me. I'm glad to see it works in 2010 as I would expect it to. Unfortunately, I'm stuck in 3.0 for awhile so I'll have to come up with some sort of work around.
    – DrZ
    Commented Feb 21, 2012 at 13:39

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.