Monday, 23 February 2009

Displaying SharePoint version information in Office documents

One thing I get asked for from time to time is to display the latest SharePoint version information in Office documents and templates. I have always found it easier to create new custom columns for this and populate them using an event handler.

Seeing as though I think this may be useful for others, I have uploaded some code and resources to Codeplex which provides this functionality. It comprises of two components:

- A site collection feature to deploy four new custom site columns for use in Content Types or document libraries where version information is to be shown in Office documents.

- A site feature which implements an event handler to populate the custom columns with version information for any document library present in the site, including the current version, when the document was last approved, who approved it, and when it was approved.

Once the custom column information is being populated by the event receiver, it can be shown in Office documents using the Quick Parts (Office 2007) or Fields (Office 2003 or 2007) features.

You can download the solution file, source code, and instructions at


  1. Yes this is a problem we have as well. I've played with the solution and got it to work fine, but it does leave me with one outstanding issue. While Word's properties are updated correctly, where the properties are used in the document as fields are not until you manually refresh the document.

    Age-old Word problem I know, I was just wondering if there was a way to kick an update of the document on the backend?


  2. Hi Neil,

    The only way I have seen this working is by using a macro to refresh the fields on opening the document - this article may help:


  3. Hi Phil,

    Yes I'd seem something similar to this before, and have implemented something similar. It is less than ideal though since distributing it is rather difficult. AutoOpen only works in or the document itself, not another template you could distribute via login scripts to the startup folder. Got a workaround for that, but still annoying. Oh and if you use Word as your Outlook 2003 compose editor then that stops those macros working.

    You'd think there would be an easier way ;-)


  4. Hello,
    Great solution! I've been looking everywhere for this!! The issue Neil raises is a problematic one (how to get the version number to auto update), but for now I was wondering how to get this to work in Excel?
    There isn't a Quick Parts feature in Excel 2007. Do I have to add macro code to get the version number in the header/footer of an Excel sheet?


  5. Hi Aaron,

    Glad you liked the solution :) - I personally have not tried adding doc properties to Excel, but typing "document properties excel" into Google gave me quite a few results from people that have, so hopefully there is some info there that may help.


  6. Hello Phil,

    If i wanted to make a dutch version of these features. What would i need to change in your code ?

    With regards,


    1. hello did you manged to build it 4 dutch sites ???

  7. Hi Hilmar,

    Just changing any reference to column display names in VersionInfoColumns.xml and ItemEventReceiver.cs should do it.

    For example, look for the DisplayName= values in VersionInfoColumns.xml and make sure the same display names are used for the item["Column Name"] code in ItemEventReceiver.cs. You will also want to change the description field in the xml file as well.


  8. Hi Phil

    I installed the solution and the installation process was completed successfully. I also activated the feature inside the site collection but the columns wasn't created.

    please help.

    Best regards

  9. Hi Chakrib,

    A couple of people have reported this on the Codeplex site and it was because they were using WSS and not MOSS (I assume you are doing the same).

    These guys just created the columns manually using the browser interface and it worked fine.


  10. Hi Phil!

    Like Hilmar did it (hopefully) for the Dutch Version, I just want to do the same for a German verion.
    To make everything right, how and where (which directory) do I have to change the files: VersionInfoColumns.xml and ItemEventReceiver.cs...
    And where do I find the right column names in German?!

    Thanks for your help!


  11. Hi Phil!

    It's me (Markus) again.
    Finally I found the files to change.
    But I've to change "Approval status" to "Genehmigungsstatus" within ItemEventReceiver.cs because of a German version I have here.

    //English Version
    //if (item["Approval Status"].ToString() == "0")
    //German Version
    if (item["Genehmigungsstatus"].ToString() == "0")

    That's no problem either, but: I'm not a developer, so how could I create the new WSP - File with my minor changes?!
    I've looked at the WSP Builder - tool. Could I use this one?!

    Sorry for the real stupid none developer questions. But I hope, there is help available!

    By the way:
    Displaying the "current version" just works as it should!

    Thanks again!


  12. Hi Markus,

    I think I used the Visual Studio extensions for WSS to compile this solution - either version 1.2 ( or 1.3 CTP ( You would need to install the extensions and then load the solution into Visual Studio. From there you can compile it and it will automatically create the wsp file for you.


  13. Hi Phil,

    this looks like a really neat solution - though I cant get it working in my sharepoint environment.

    We have a WSS 3.0 installed, weve run the installation without problem. We have added the columns by adding custom columns.

    The problem is that the columns turns out blank and we are, therefore, unable to show the metadata in the documents as well.

    We have followed the installation pdf and cant figure out what is wrong.

    I seriously hope you can help us since weve been looking for a solution like this one for some three years now.


    / Daniel Persson

  14. Hi Daniel,

    If the columns are not being populated, it sounds like something is preventing the event receiver from running. Are you sure the SITE feature is enabled in the site containing the document library? It will need to be activated in EVERY SITE you want to use it - unlike the site collection feature which only needs to be activated once during the installation.

  15. Hi Phil,

    I posted this on the CodePlex site:

    But, since I see very little activity there I decided to post here also. Sorry for the duplication, but I am looking for a solution to the issue if possible.

    First of all EXCELLENT utility. This is a feature that should have been included with SP.

    Installed with MOSS 2007 and clients using both Office 2007 and 2010.

    I have tried using the this both with and without linking to approval workflow. In all instances the "Approved By" field is populated with the the document originator and not the approver. And, not matter the process I use to approve (i.e., work flow or direct approval from dropdown) the result is the same.

    Can someone here give me some direction on how to proceed.

    Thanks in Advance,

  16. @Gus - Thanks for reporting the error. This has now been fixed and a new version uploaded on the Codeplex site.



  18. Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.

    Friendly Links: Toms Shoes Womens | Toms Clearance



  20. The latest trend in Coach Outlet Online is to purchase them secondhand.
    Today, buying Michael Kors Bags Outlet is looked upon as a smart choice.
    Because Michael Kors Purse Outlet are crafted of the finest material, they are known to last for many years, making them the perfect purchase.
    Some women are fanatical about changing their Coach Outlet Store Online or their style every few months, making it necessary to periodically clean out their wardrobe.
    Other women buy a MK Outlet for one specific occasion and some women just make a habit of buying a lot of purses.
    The trends are changing today; more and more people are buying classic shoes, including designer Cheap Real Yeezys.
    If your dream has always been to own a Cheap Yeezys, it is possible just by finding a store and click here.
    Coach Bags Clearance are pursued by many famous characters.
    Coach Bags Outlet in different styles and different colors are in different leathers.
    Next time, I will share some knowledge about how to maintain the bags in different material.