Thursday, November 10, 2011

SharePoint 2010 Document ID in Word

What is required?
  • A content type in your content type hub
    the document id feature must be enabled in the CT hub
  • A site collection where the document if feature is enabled (original library).
  • A site collection where the document if feature is NOT enabled (will be used to create template)
  • Both site collections must be subscribing to the content type hub, so they inherit the content type.

Prepare your content type:
  • Make sure the “Document Id Service” feature is enabled in the content type hub.
  • In the content type hub, go to Site settings > site content types.Create a content type if you haven’t already done so.
  • Edit your content type, select “Information management policy settings”.
  • Click “Enable Labels”.
  • In the Label format input field, write {Document ID Value} and click OK.
  • Republish your content type (”Manage publishing for this content type”).
  • Run the following timer jobs from central Administration:
    • “Content Type hub”
    • “Content Type Subscriber – <your web application name>”.
Prepare your Microsoft Word Document Template

  • Create a document library in the site collection where there is no document id.Note: It is crucial that the “Document Id Service” feature is disabled. If your document template gets a document id here, it will be stuck in the template, and all documents based on that template will get the same document id as the template, which is obviously not what you want!
  • Go to library settings >> advanced settings, and enable content types.
  • Click “add from existing site content types” and add your content type.
  • Upload your Document template to this library.
  • Make sure that it is given the correct content type.
  • Open the Document template in MS Word from the library.
  • Place the cursor in the correct location.
  • Click Insert – Quick Parts – Document Properties – Label.
  • This will add label as shown below.
  • Add a Word macro to the template: Open the template in Word, click the Developer tab Macros – call it Reload and hit Create.
    Add following code inside “Reload”
Sub Reload()     ActiveDocument.ReloadEnd Sub
Add another macro “FileSave” and call Reload directly after save. This will make the Document ID show in the document.

    Sub FileSave()  
          Dialogs(wdDialogFileSaveAs).Show
          Reload
    End Sub

Add another macro “FileSaveAs” and call Reload directly after save. This will make the Document ID show in the document.

    Sub FileSaveAs()  
          Dialogs(wdDialogFileSaveAs).Show
          Reload
    End Sub

  • Save and close word.
  • Upload the template to the content type. In the content type hub, go to site settings – site content types, edit your content type, click advanced settings, add upload your template there.
 

Popular Posts