I have a scenario where I'm provisioning a document on the server after collecting some metadata.
Environment is SharePoint 2010 and Office 2010.
The SharePoint list item and file are created correctly. The SharePoint list item has all of the proper metadata assigned in SharePoint.
However, when opening the document in Word 2010, the DIP shows that the managed metadata fields are blank, even though they have the correct value in SharePoint. If I save the item in SharePoint through the UI, it works like a charm and the managed metadata properties (taxonomy fields) are fine if I open it in Word again.
If I try to call SPFile.Update(), SPListItem.SystemUpdate() or SPListItem.Update(), it has no effect on pushing the properties down to the document.
I've found that in the case where the managed metadata properties don't stick, the XML of the document looks like this:
<RegionTaxHTField0 xmlns="3a290427-a0ba-4a8f-bf50-36a9ad2bef07">
<Terms xmlns="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"></Terms>
</RegionTaxHTField0>
After saving the item in the UI, the XML looks like this:
<RegionTaxHTField0 xmlns="3a290427-a0ba-4a8f-bf50-36a9ad2bef07">
<Terms xmlns="http://schemas.microsoft.com/office/infopath/2007/PartnerControls">
<TermInfo xmlns="http://schemas.microsoft.com/office/infopath/2007/PartnerControls">
<TermName>Japan</TermName>
<TermId>c2a154e3-8bb0-4b56-b083-297526964fd9</TermId>
</TermInfo>
</Terms>
</RegionTaxHTField0>
Unforunately, there isn't a whole lot of documentation on this TermInfo element out there on the web. I'm trying to figure out how I can get SharePoint to generate those extra elements (instead of doing it in OpenXML) since, obviously, SharePoint can do it.
Ideas and pointers would be much appreciated!