I just learned this from a colleague who learned it at a SharePoint Developer class: When you create a custom Content Type for a document template, and add custom metadata fields to it, you can insert the metadata values into your Word document as Quick Parts.
Several elements need to be in place to make this work smoothly. In my example:
- I created a Content Type for a NonDisclosure Agreement (NDA)
- I created a Site Column for Opportunity (i.e., the client name)
- I added the site column to the NDA content type
- I added the content type to one of the document libraries on my SharePoint site
- I created a new NDA from the "New" menu on the document library and
- IMPORTANT! I saved the document back into that document library. (The Properties Quick Part will appear grayed-out until the document is saved.)
Then, with the document still open in Word, I was able to choose Insert -> Quick Parts from the ribbon, and my "Opportunity" field is available.
If the metadata field is already filled in for the document, you will see the actual data appear in your document (just as when you add the a Date field and today's date appears).
If the metadata field is empty, you can type the information into the document field, and you will see it will appear in the Properties (Server) window in the ribbon..
Lots of potential for bringing your paper forms online and ensuring better metadata compliance!
Here's a nice post from the Microsoft Word team on the subject – they refer to it as XML Mapping.
Update 9/8/08:I am not aware of a way to insert these document properties into an Excel spreadsheet in a similar manner.
Good post.
I have a problem trying to insert a Document Property that comes from a column in SharePoint wich data come fron a list lso in SharePoint. I mean a combo field.
When I close and open the .docx the combo appears empty...??
Any help? Thanyou very much.
Posted by: gpinto | June 23, 2009 at 11:18 AM
How do you get the server properties to show up in the document template itself automatically. I can do what is listed here in this post quite easily, but I would like portion of the template to automatically update based on the documents sharepoint properties.
Posted by: Matt | December 08, 2010 at 08:58 PM
@Matt, do you mean that you would like the document template to be updated when new properties are added to the document library? What version of Office and SharePoint are you using?
Posted by: sadalit | December 09, 2010 at 07:57 AM
there is a bug with office 2007 that doesn't suppport lookup columns properly inside the document (displays #ID) but displays fine in document information panel. It now works fine in SP 2010.
Posted by: Ben | January 23, 2011 at 03:15 AM
Ben, thanks for this! I haven't tested that in 2010 but I appreciate the information!
Posted by: sadalit | January 23, 2011 at 11:20 AM
I have a picture column in Sharepoint that I would like to usein Quick Parts. Is that possible? It doesn't show up in the Document Property/Quick Parts drop-down.
Posted by: S Griffin | March 23, 2012 at 11:44 AM
Event Receiver I suspect, however if you've found a better way in the last two years let me know ;-)
Posted by: Drlargepants | August 09, 2012 at 10:30 AM
Great post.
Is there a way to insert qiock partrs into the header using a vba script. I have over 1k documents I would like to apply this too.
Posted by: Jayson | September 29, 2015 at 06:49 PM
Jayson, thanks for your question. Would this help? http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/Q_28001513.html
Posted by: Sadie | September 30, 2015 at 09:34 AM