This project is read-only.


Open from MOSS document library fails


  1. Boot Word
  2. Insert plain text content control
  3. Save as "foo.docx" and close Word
  4. Open the CCT
  5. Add a custom xml part
  6. Give the root node some text, "foo"
  7. Bind the content control to the root
  8. Save and close the CCT
  9. Navigate to a MOSS document library
  10. Upload foo.docx
  11. From the library, click to read only open
    Word says there is an error on open
    Expected Results:
    No error
    This only repros using the CCT. Binding a document through the object model does not reproduce this bug. SharePoint must be mangling the xml parts.
Closed May 12, 2007 at 7:20 AM by mrscott


wrote May 12, 2007 at 7:20 AM

Resolved with changeset 22376.

mrscott wrote May 12, 2007 at 7:32 AM

After debugging, I’ve discovered that if your document library requires some meta data to be injected into your document (like say have a barcode policy enforcement), SharePoint will go through all the itemPropsN.xml files in \customXml of the package and rename the itemID’s if it does not fit the default pattern of bracketed guid. For the bug in my case, SharePoint actually renamed a perfectly good itemId and then Word failed to open the document because the referenced ID does not exist (SharePoint invented a new one).

To summarize, here’s SharePoints bug: They decide to rename any ds:itemID in \customXml if the string is not in this format “{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}”.

It turns out my tool decided not to put those {} chars and that’s what confused SharePoint.

DougHawes wrote Apr 1, 2011 at 1:58 PM

I found that I needed to change the NewGuid() to Upper Case below in order for the document to pass using words validation method. As shown below:
        xp.Id = "{" + Guid.NewGuid().ToString().ToUpper() + "}"; /* Using brackets are required due to SharePoint bug. See */
Before the change I get the following error:
Error description: The attribute '' has invalid value {934ced07-88bf-4c02-980f-71347446b493}'. The Pattern constraint failed. The expected pattern is {[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}}., Content type of part with error application/vnd.openxmlformats-officedocument.customXmlProperties+xml, Location of error /ds:datastoreItem[1]

wrote Feb 22, 2013 at 12:32 AM

wrote May 16, 2013 at 12:02 PM