Auto-incrementing in-Word-document version number from template across multiple SP online sites




I've been looking at this for some time now but cannot find a solution.


I can solve the first part of the issue - embedding a version number field into a Word document template which will automatically keep in sync with the checked-in version number when a document created from that the template is stored in the Sharepoint document library. The most straight-forward way seems to be to create a label in the Sharepoint document library against the 'Document' type. That label shows the value in the included-as-standard Version field via {Version}.


Provided the template is created within same Sharepoint library that any documents generated from that template are stored in, then Happy Days - it all works and generated .docx documents do pick up automatically incrementing Version fields via the label which got embedded into the .dotx template file. 


Where it falls down is if a document created with that initial template is stored in a different Document Library, or tenant site - even if that new destination also has a version label created in exactly the same way as the original Library had. I suspect that behind the scenes, Sharepoint is using GUIDs to manage these references (keeping the friendly, matching column names for human consumption), and that a label or field is in fact uniquely identified across the entire tenant site collection.


The challenge is that our processes involve the creation of 'standard' Sharepoint sites on a project-by-project basis. Each project will create its own set of documentation and store that in the document library of the Sharepoint site which was created for it. We use a set of standard document templates which are picked up from a central location. I need to be able to equip these centrally-held document template files (.dotx) with embedded version metadata which will automatically reflect the incrementing version number which the generated document is assigned within its (revisioning-enabled) Sharepoint document library through the check-in process.

The overhead involved in re-specifying the version-number-references in every template to reflect the new document library's label GUID every time a new project-Sharepoint-site is created is not workable.


Can anyone advise on how to do this please? We use Sharepoint online, rather than a locally-hosted installation, incedentally. 


Managed Metadata columns defined at the 'root' tenant level looked promising initially, but it seems that these can only store static data - intended to be referenced by lookups etc - so can't help.


Other suggestions surround creating Visual Studio Add-Ins or Apps and uploading them but:

A) I'm not sure on exactly what we need to create as there doesn't seem to be anything which speaks to our specific scenario     and

B) I'm concerned that if we did that, we would be back to square one by dint of these unique GUIDs across different tenant sites or document libraries.


Input would be great appreciated!



1 Reply