

SetCoverPageProps Location, "CompanyAddress", "Company Address", wdContentControlText SetDCoreProps Location, "creator", "Author", wdContentControlText SetMSCoreProps Location, "contentStatus", "Status", wdContentControlText SetExtendedProps Location, "Company", "Company", wdContentControlText SetMSCoreProps Location, "category", "Category", wdContentControlText SetCoverPageProps Location, "Abstract", "Abstract", wdContentControlText ' pass the name of the element (since it does not change when you change the user interface language) ' Location is a Word Range where you want to insert the Content Control Sub insertAndMapProperty(Location, PropertyName) ' As Word.Range, As String ' or wherever you want the code to reside. ' a simple test - place inside the normal.

XMLMapping.SetMapping as extracted from document.xml (see above)

* You will need to change: sharePointPropsMappings= and. * Changes go into: the Sub setSharepointProps() With this information, I modified the code provided by as a VBA macro inside my normal template and everything worked.įor the sake of helping others, here is my code adapted from Note that you will need to adjust based on your library setting as explained above.Lesson learned is that it is best to carefully think of naming convention before creating the library columns. Hence, you can see in the code below that I have in some cases properties which mapping differs from the desired given name in the final SharePoint. I realized as well that unfortunately once a column is created in SharePoint, the name will not change in the XML mapping regardless of whether the name is changed in SharePoint or not, which could be expected.The w:xpath attributes were different for each property and match the information I could find the document "XML Map" (see the original question for screenshot).It might change for different libraries (to be verified) The w:prefixMappings attributes were identical for all properties.You can then find the general path of the document at the following element\attributes:.Open the file with my favorite XML editor.Extract \word\document.xml document contained in the archive.Insert in the word file the control content manually (see original question).Create an MS Word file in my SharePoint library (with some user columns).In order to find this information, I did the following: XMLMapping.SetMapping path to the document properties. Here is what worked for me to link content control to the Document Properties inherited from the SharePoint library (an example is given for user-defined columns).įrom the solution provided by I was unclear how to find the.
