Monday, November 16, 2009

SharePoint Document Property Names

Recently while working on embedding SharePoint properties within a Word 2003 document I discovered some oddities with the names. When working to embed a property named Doc No. I found at times one of the 3 following situations displayed in the Field list:
  1. Doc No.
  2. Doc No. and Document No.
  3. Document No.
If i used Doc No. the value would be incorrect. If I used Document No. the correct value would display and would synchronize.

Upon investigation I looked at the AllLists table in the database to find the row for the Document Library I was using. Examining the ContentType column explained the behaviour. For the field Doc No. this is the value I found:

DisplayName="Doc No."
Required="TRUE" Hidden="FALSE"
ReadOnly="FALSE" PITarget="" PrimaryPITarget=""
PIAttribute="" PrimaryPIAttribute=""
Aggregation="" Node=""/>


Notice that the name is Document No. (after decoding) and the DisplayName is Doc No. After seeing this, I remembered initially naming the column Document No. and then shortening it to Doc No. SharePoint obviously retained the original name as the ID of the field and just adds the DisplayName attribute to show the changed value. This is definitely a gotcha and will lead to some confusion for users. But at least the behaviour is now explained.

No comments: