Share via


Inserting a document ID into a word document

Question

Thursday, December 2, 2010 8:38 AM

Hi all,

I would like to have the document ID embedded in the footer of word documents automatically.  Once a document is created I can insert the value (Insert | document properties | Document ID : Value) without a problem.

What I would like is to do this in the document template, but the Document ID: Value isnt available (as I guess its not been created yet).  I could use a workflow to update the document after creation but I wondered if anyone has a smarter way of acheiving this?

 

Thanks

Bren

 

 

All replies (6)

Monday, December 6, 2010 5:47 PM ✅Answered

There is no document ID until the first save, so you'll have a little problem having it available on first open.


Thursday, December 2, 2010 9:01 AM

I haven't tested this.. Just check the below solution.

First create a new document and download/open it in client PC. Open header and Footer. Then in Footer Place place the cursor and select "Quick Parts" -> Document Property -> <List of all Properties including server properties>( I could see all Server properties of the Document in the quick part list). Select the Document ID property. If Document ID not exist then create a column/metadataproperty in the document library. Then save this document in local disk. Open Document library settings and upload this document as template. Now it should work for all new documents.

Just check and revert if works!

 I've done with other columns and it's working. Refer the Post : http://geekswithblogs.net/venkatx5/archive/2010/12/02/how-to-use-sharepoint-list-data-inside-document-headerfooter.aspx

Revert if you have any issues and comments. :)

Regards,
Venkatesh R
/* My Code Runs in Visual Studio 2010 */
http://geekswithblogs.net/venkatx5/


Thursday, December 2, 2010 2:57 PM

Hi, thanks for the reply.  What you outlined is pretty much how I was attempting to do it - the problem is that the "document ID" feld isnt available until a new document has been created (its not available in the template).

Any ideas anyone?  This would be a very useful bit of functionality.

Thanks.

 


Friday, December 3, 2010 4:18 PM

How about using VBA to grab and update the field value after the first save?


Saturday, December 4, 2010 12:25 PM

Yes I'm sure VBA could do this or on the SP side a simple workflow to copy the document ID value to another field.  Problem with either of these is that the user would have to save and then go back into the document.

 

Ideally the ID would be available right away but I'm not sure that is possible.

Cheers

 


Thursday, May 19, 2011 8:09 AM

Hi MalvernRoller,

Check my blog post on how to automatically insert the document id into word documents. I use a content type in a content type hub, a label policy on the content type, and some simple vba in the word template to close and re-open the document when the user saves the first time:

http://devramblings.wordpress.com/2011/04/10/insert-sharepoint-2010-document-id-in-a-word-document/

 

Øystein Garnes
http://devramblings.wordpress.com/