SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

Event Receivers - Forcing overwrite of a document property?

Last post 05-15-2008, 4:18 PM by Stephen.Hynds. 2 replies.
Sort Posts: Previous Next
  •  05-15-2008, 3:50 PM 10750

    Event Receivers - Forcing overwrite of a document property?

    I have an event receiver which is on about version 15000000, and I really thought I'd nailed it this time.

    Then a user broke it again.

    When the document is uploaded to the library it is tagged with some metadata based on the folder it gets inserted to. All well and good, except when the document already has this metadata inside it because someone has copied it out of SharePoint, made some changes to create a new document, then uploaded it to a different folder.

    My code overrides the ItemAdding event, and sets the "AfterProperties" to the appropriate values, but SharePoint appears to completely ignore this after its finished with my code when the document being uploaded already has these properties in it.

    Can anyone think of a way for this to be solved?

  •  05-15-2008, 4:06 PM 10752 in reply to 10750

    Re: Event Receivers - Forcing overwrite of a document property?

    I'm not overly sure about the Event Handler process personally but my first thought would be that it's seeing the document move as an edit, so have you tried binding the methods to the ItemUpdating event as well?
    Paul Leigh
  •  05-15-2008, 4:18 PM 10755 in reply to 10752

    Re: Event Receivers - Forcing overwrite of a document property?

    I've written a custom webpart that handles the moving of documents between the folders (they represent meetings in another list) which is working fine, because it's using an SPListItem.

    They've been told to use the move/copy function just now that I provided, but I can't disallow them from copying a file off of SharePoint and then re-uploading it for a different folder which is what's causing the issue.

    Property promotion and demotion seems to be at play. I don't know when the promotion event (if there even is one) is being fired, but it would appear that it happens after the ItemAdding event.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems