UPDATE: I've just verified this technique also works with SharePoint 2010. Also keep in mind this technique only seems to work for documents in MS Word 2007 .docx format. I assume it will also work in MS Word 2010, but I have not tested that yet.
UPDATE 2: I should have posted this sooner, but I have run into problems on SharePoint 2010 with sites that are heavily customized (sites from MOSS 2007 that had been heavily customized before being upgraded to 2010, then copied to create new sites) getting versioning to work as described below. I havent been able to determine what the problem is or how to fix it yet.
UPDATE 2: I should have posted this sooner, but I have run into problems on SharePoint 2010 with sites that are heavily customized (sites from MOSS 2007 that had been heavily customized before being upgraded to 2010, then copied to create new sites) getting versioning to work as described below. I havent been able to determine what the problem is or how to fix it yet.
One of the requirements here at work is that we normally save the current "version number", which is user entered and maintained, into word documents that go out to clients. At some point, someone ends up forgetting to update the version number and version history, but they always have to enter that information into SharePoint when they check the document in. So, how can we automatically insert that information into a word document from SharePoint?
Sadly, there is no easy "out of the box" way to do this. The version number you see in the properties of a word document is MS Word's own internal version number that does not relate to the SharePoint version number in any way.
One solution I've found to work well is setting up an information policy on the document library in order to enable labels. You can then define a label that displays the current version number, which you can then insert into a MS Word 2007 document as an image (it seems to look best in the document footer, imo). Here's how:
- Create a new document library or modify an existing one
- In the library settings, under "Advanced Settings" set "Allow management of content types?" to "yes".
- Enable versioning (it does not matter if you do minor versions or not).
- Create a new information policy on the library, and select the content type you want the label to be available to (I use the default "document" type).
- Define a new policy, check "Enable Labels". Do not check the other two options Below it. In the "Label format" field, enter something like "SharePoint Version Number: {Version}". {Version} is the field that will display the version number. Modify the "Appearance" settings to suit your needs, then click "OK".
I typically set the size of the label to something thin, like .5 inches, so I can tuck it into the footer of the word document and still keep the footer small. Now, the label will not automatically show up in your documents, you still need to insert the label yourself. And so far, it seems this feature only works with Word 2007 documents, my 2003 word documents just display a field name rather than a number. Anywho, to setup your word document:
- Create a new document in the library.
- Save the new word document as a word 2007 file (.docx format) in the library.
- Check out and edit the word 2007 document, click the "insert" tab in the ribbon, then click "Quick Parts" in the "Text" button group. Under "Document Properties" click on "Label" to insert your SharePoint label as an image.
- save your document, checkin and close word 2007. Then re-open the document and you should see the label change to the actual SharePoint version number of the document.
..and one last thought - Since the format of the text for the version number label might change due to personal preference (some might want to use "SharePoint Version Number: x", while others use "Version: x") it may be a good idea to simply display the version number only, as a small image by itself with no additional text. This way the document author has more control over how the version number is displayed and described in their document.
19 comments:
I've tried this, but when I look in the Quick Parts menu, the Document Property option is greyed out. When I instead use Insert > Label, the SharePoint Version number does not appear. I can type in a version number while editing, or I can leave the default, {_UIVersionString}, but either way, the entry does not contain the actual SharePoint Version number.
Mcmerlla, I'm going to add a few screen shots showing my Document Library configuration as well as what I'm seeing in word. Hopefully that will help you out.
How do I display Custom Metadata column value in Word 2003 Document footer automatically while uploading a word file in MOSS Document library?
Hi Surya,
I have not been able to get this feature to work in Word 2003. I have only been able to confirm this works using Word 2007.
Bryan, I hereby declare you a genius.
Great explain how to add data from SP to Office documents. But when I add version in a WORD document and want to convert the document it gives an error. Have you got an workaround or solution?
dadu4net, I have not tried converting a MS word document with a SP version number in it to another format, or version of MS word. Feel free to leave a comment with more details about the document conversion trying to do and the error you're seeing. If I have time, I'll try to reproduce it on my end.
Are you able to save this site as a template?
I have discovered that (in SP2010) setting up the policy then prevents me from saving the site as a template! (this worked ok for me on 2007)
Any ideas why? Or, more importantly how to get round it?!
george26 - I just ran a quick test and I was able to save off a site template which contains a document library with an information policy in SP2010. The link to create a site template shows up in the site settings page under the section "Site Actions". If you see the link but the link does not work for your site...then something wacky is going on. Maybe try using the collection administrator account, or another account that has full access to your entire site collection. Hopefully its just a permissions issue, and using an account with higher permission levels will solve the problem for you.
I also tried to do this on SharePoint 2010, but found that if I save site as template I get "Error exporting list named 'Shared Docuemtns' at the URL: Shared Docuemnts".
I am site collection admiistrator.
If I then disable the Label policy I can save site as template without this error.
I installed SharePoint Server 2010 from MSDN download with Enterprise Cal, in Farm mode on a single server.
Havent had a chance to try testing on a brand new site yet (I'm still testing off of a site upgraded from MOSS 2007, which may be why it works for me?) ... but have you tried doing a site copy yet? That might get you around the issue if you just need a copy of the site in the same collection.
For sites located at the root of your collection you can create a temporary site off the root, then copy your site into the temporary site, rename it, then copy the copy back to the root. Hopefully that will work.
Bryan - yes, this also works for me on a 2007 site migrated to 2010...
SighLentKnight - thanks for repeating the problem - at least I know it's not just me (although I'm sot sure if that's a Good Thing or not?!)
I need to be able to create a site template to give to my customer, so they can create their own project sites. Being able to display the version number in Word Documents is a key requirement for them (and one that works in our 2007 solution) so this not working in 2010 is a real big pain for me.
Bryan,
I have tried this and entered everything as per your screen shots except that in the Edit Policy: Document - The preview shows:
Document Version : {Version}
and not
Document Version : {_UIVersionString}
like in your screen shot.
When I follow the steps and place the label in a doc, save and checkin and then checkout again the string does not change. It still shows: Document Version : {Version}
Editing and doing subsequent changes show new versions in Sharepoint but the values are not substituted in the Word 2007 doc.
Is there something in your MOSS 2007 that is turned on/off that maybe we need to do for our site?
Thanks.
Rick, my first thought - double check that you have versioning enabled on the document library.
A suggestion for troubleshooting - if you happen to be working on a heavily customized document library (custom content types, properties,etc) you might want to try testing this on an out of the box document library first.
Bryan is my new favorite person! I would bear your children but I'm a guy...
Has anyone had any luck with getting this working with Excel not Word? This solution works perfectly in Word for me but I just see {_UIVersionString} when I follow the process with Excel. I'm running SharePoint 2010 and Excel/Word 2010.
I've run through everything to set up a policy for the specific content type that I am using. The policy appears to be in place, but when I upload a document, the Label does not appear in the Quick Parts|Document Properties list.
Rick I had the same problem. Instead of {Version}, I typed in {_UIVersionString} directly and it worked.
Post a Comment