SharePoint Server Content Type field binding to Content Controls in Word
One of the coolest things I like about SharePoint Server 2007 and Word 2007 is the ability bind information from your document to properties that can be viewed & edited in SharePoint. Unfortunately creating the seamless experience requires a few more, well a lot more, steps than I would prefer. Still, it only takes a matter of minutes to do this once you know what you're doing.
Here is a step-by-step walkthrough of how to bind a custom content type field to a content control in Word. For reference purposes after each navigation step that occurs in SharePoint, I’ve included the name of the page you should be on after performing the navigation.
1) Create a Hello Word content type:
a. Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)
b. Click Site content types (mngctype.aspx)
c. Click Create (ctypenew.aspx)
i. Name: Hello Word
ii. Select parent content type from: Document Content Types
iii. Parent Content Type: Document
iv. Click OK
d. Add a column to the content type
i. Click Add from new site column (fldnew.aspx)
1. Column name: My Value
2. Click OK
2) Create a Hello Word document (optional template)
a. Create a new word document
b. Enter the text: Here is my content type field value:
c. Save the document as “Hello Word” to local disk
3) Associate the document with the content type
a. Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)
b. Click Site content types (mngctype.aspx)
c. Click Hello Word (ManageContentType.aspx)
d. Click Advanced settings (ChangeContentTypeOptionalSettings.aspx)
e. Select Upload a new document template
f. Click Browse and locate the Hello Word.docx document
g. Click OK
4) Create a document library that uses the Hello Word content type
a. Site ActionsàView All Site Content (viewlsts.aspx)
b. Click Create (create.aspx)
c. Click Document Library (new.aspx)
i. Name: Hello Word Library
ii. Click Create
d. Associate the Hello Word content type with the library
i. SettingsàDocument Library Settings (listedit.aspx)
ii. Click Advanced settings (advsetng.aspx)
1. Allow management of content types?: Yes
2. Click OK
iii. Under the Content Types section click Add from existing site content types (AddContentTypeToList.aspx)
1. Select site content types from: Custom Content Types
2. Add the Hello Word content type
3. Click OK
iv. Click Change new button order and default content type (ChangeContentTypeOrder.aspx)
1. Uncheck the Visible check box for the Document content type
2. Set the Position from Top attribute of Hello Word to 1
3. Click OK
4. Click Hello Word Library in the breadcrumb to get to the default view of the document library.
5) Bind the content type fields to content controls in Word
a. Click NewàHello Word
b. Place the cursor just after the text in the document (“Here is my content type field value:”)
c. In Word now, select the Insert tab
d. Select Quick PartsàDocument PropertyàMy Value
e. Save the document to your LOCAL drive as “Hello Word”
6) Upload the new bound version to the content type
a. In SharePoint, Site ActionsàSite SettingsàModify All Site Settings (settings.aspx)
b. Click Site content types (mngctype.aspx)
c. Click Hello Word (ManageContentType.aspx)
d. Click Advanced settings (ChangeContentTypeOptionalsettings.aspx)
e. Select Upload a new document template:
f. Click Browse and locate the bound version of the document you just created.
g. Click OK
7) Test it out
a. Go to the Hello Word Library and select New
b. Enter a value in the My Value content control
c. If the Document Information Panel isn’t displayed, select the round Office button in the upper left corner then PrepareàProperties
i. In the document information panel (DIP), you can select either the custom properties (i.e. Hello Word Properties – Server) or the standard Document Properties). Make sure you’re viewing the Hello Word Properties. You should see two fields: Title & My Value
d. Notice that the My Value field in the DIP contains the text you entered in the content control.
e. Change the value shown in the DIP and notice that the content control value changes
f. Save the document to the Hello Word document library.
8) Modify the default view of the document library to include the My Value column
a. In the Hello Word Library, select Modify this View from the View drop-down (ViewEdit.aspx)
b. Check the Display field next to My Value
c. Click OK
9) Update the My Value field in SharePoint
a. In the document library, select Edit Properties from the drop-down associated with your document (EditForm.aspx)
b. Change the value shown in the My Value field
c. Click OK
10) Open the document in Word and notice that the updated value is shown in the content control. Sweet!
If your going to take this further by extending the template with VSTO, this is your starting point - a Word document that has already been bound to it's associated content type fields. Once you're ready to publish, you need to upload the VSTO extended document to the content type one more time while deploying the assemblies to another location.