Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Situation:

Problem:

  • When I create a new document in subsite B - my quickparts are working.
  • When I create a new document in the library in subsite C - my quickparts don't work. My Document Information Panel is not in sync with the quickparts. And thus it's not possible to set my metadata with those quickparts.

    It seems like he's pointing to the wrong URL. Is this a bug?

Thanks in advance!

share|improve this question
    
Looks like quickparts can only be scoped at document library level. So you need to set a template for every LIST content type. Not ideal, but I think we have to live with it for now... –  Sven Gillis Feb 8 '12 at 12:19

1 Answer 1

This problem is caused by differences in the SourceID property of the metadata fields. If you compare the value of SourceID on a field of a content type in one library with the same field of a content type in another library you will see that they differ, and they are used inside the Word document when referencing the metadata field.

The solution is to set SourceID to a fixed guid. Since it is a readonly property it has to be changed by altering the xml schema of that field, for example like this:

private static void SetSourceID(SPWeb web, string fieldName, string guid)
{
    SPField webField = (SPField) web.Fields[fieldName];

    XElement schema = XElement.Parse(webField.SchemaXml);
    XAttribute sourceID = schema.Attribute("SourceID");
    if (sourceID == null)
    {
        sourceID = new XAttribute("SourceID", guid);
        schema.Add(sourceID);
    }

    webField.SchemaXml = schema.ToString();
    webField.Update(true);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.