none
update Word template Quick Parts with document parser (property promotion/demotion) disabled RRS feed

  • Question

  • We have a custom document management system built on top of SharePoint.  The custom versioning implementation required we disable the document parser to stop property promotion, i.e. uploaded document properties from overwriting the library metadata.  Unfortunately this also disables property demotion so library metadata changes do not write back to document properties.  This is causing various Quick Parts in the document template to not update as library metadata changes.

    Is there a way to update custom properties embedded in the document in the itemupdated event triggered by a library metadata change?  Conceptually  - set SPFile.Property["customProperty"] = SPListItem["customProperty"]? The goal is to update the Document Quick Part to reflect the changed value.

    Thanks

    Fred

    Friday, January 13, 2017 3:38 PM

Answers

All replies

  • Hi,

     

    The SetCustomProperty provided by Open XML SDK would be helpful.

    How to: Set a custom property in a word processing document (Open XML SDK)

    https://github.com/OfficeDev/office-content/blob/master/en-us/OpenXMLCon/articles/30dfce05-00c1-423e-b4b4-149329fdf184.md

     

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Marked as answer by Fox4 Monday, January 23, 2017 8:40 AM
    Monday, January 16, 2017 3:18 AM
  • Thanks Lee

    This looks promising.  I will have one of my devs look at it.

    Thanks

    Fred

    • Marked as answer by Fox4 Monday, January 23, 2017 8:40 AM
    • Unmarked as answer by Fox4 Monday, January 23, 2017 8:40 AM
    Tuesday, January 17, 2017 8:49 AM
  • We decided to go another route.  We will leave the document parser enabled, and "protect" certain library metadata by assigning the BeforeProperties original values to the approriate list item fields in the item Updated event.  Essentially we are allowing property demotion but not promotion.

    I am not certain about firing sequence of item Updated vs doc parser property promotion.  Am I overwritting the promoted value with the original value, or am I forcing property demotion with item.systemupdate?

    regards

    Fred

    Thursday, January 19, 2017 10:04 AM
  • Hi,

    Based on my test, we could get the properties in ItemUpdating event.

    You could try to override the afterproperties.

    properties.AfterProperties["vti_title"] = properties.ListItem["Title"];

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, January 20, 2017 7:10 AM
  • Thanks Lee

    I use this - Before/After properties (originally posted by SYNERGY).  It lays out list vs library and original vs changed values for various list events.  Trick is to detrmine best event to override based on requirements.

    I am marking your previous reply as an answer to my original question.

    Fred 

    Monday, January 23, 2017 8:40 AM