2

I have a problem that i've struggled with for a long time. This problem manifests itself in the test environment, but not in my dev environment.

I have a document library template. In a event handler I attach several content types (which all inherit from a base content type which in turn inherits from Document). The base content type has a custom document template, and event handlers defined in xmldocuments on the contenttype definition.

The Doc-ID feature is switched on in the site.

When uploading a file to the document library, the document is assigned a document ID as expected. When saving a file from Word however, the doc-ID is blank. Apparently the value is set on the item, because when changing the content type of the item afterwards, the doc-ID appears with a number indicating that it was assigned when the file was first saved. When setting the contenttype back to the original value, the Doc-ID remains displayed in the view.

To clarify: This is not the ID field of the Item content type, but the Doc-ID that is created by the doc-ID feature in SharePoint 2010.

Any ideas to why this value is not set when promoting values from Word?

Øyvind Skaar
  • 1,842
  • 14
  • 22

1 Answers1

0

It seems that the solution lied in the base Document content type in the site collection. When the document-id feature is activated, event handlers are added to the content type definition as xmldocuments. When a regular document library is created, the content type in the library inherits from this content type, and thus gets a copy of the event receivers. My custom document library with custom content types did not inherit from the site collection document content type, but rather from the base document content type (0x0101), and did not get a copy of the event receivers. Copying the xmldocuments into my base content type seems to do the trick.

<XmlDocuments>
        <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
          <spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
            <Receiver>
              <Name>Document ID Generator</Name>
              <Synchronization>Synchronous</Synchronization>
              <Type>10001</Type>
              <SequenceNumber>1000</SequenceNumber>
              <Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
              <Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
              <Data>
              </Data>
              <Filter>
              </Filter>
            </Receiver>
            <Receiver>
              <Name>Document ID Generator</Name>
              <Synchronization>Synchronous</Synchronization>
              <Type>10002</Type>
              <SequenceNumber>1001</SequenceNumber>
              <Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
              <Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
              <Data>
              </Data>
              <Filter>
              </Filter>
            </Receiver>
            <Receiver>
              <Name>Document ID Generator</Name>
              <Synchronization>Synchronous</Synchronization>
              <Type>10004</Type>
              <SequenceNumber>1002</SequenceNumber>
              <Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
              <Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
              <Data>
              </Data>
              <Filter>
              </Filter>
            </Receiver>
            <Receiver>
              <Name>Document ID Generator</Name>
              <Synchronization>Synchronous</Synchronization>
              <Type>10006</Type>
              <SequenceNumber>1003</SequenceNumber>
              <Assembly>Microsoft.Office.DocumentManagement, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
              <Class>Microsoft.Office.DocumentManagement.Internal.DocIdHandler</Class>
              <Data>
              </Data>
              <Filter>
              </Filter>
            </Receiver>
          </spe:Receivers>
        </XmlDocument>
      </XmlDocuments>
Øyvind Skaar
  • 1,842
  • 14
  • 22
  • Hi, I have similar scenario : i have one ctype CT1 which inherrts from page ctype, another ctype CT2 inherits from CT1 and another one "CT3" inherits from CT2 means : page->ct1->ct2->ct3 . I imported their xml from cksdev, which added the above event recievers to all ctypes i.e. ct1,ct2 and ct3. i tried all combinations like remove EH rom all, add to all & so on. but in all cases, i donot get docid generated for pages created from page layout made using ct3, even cant see docid property for pagelayout when seen in spdesigner.(docid feature is activated).. anry help..u can do.. – vikas mehta Apr 24 '12 at 13:10
  • It seems like this feature really isn't meant for developers. The best route may be to create your content types in runtime with code, using the base document ct in each library as base. – Øyvind Skaar May 03 '12 at 08:25