SharePoint 2010 Document Property Promotion

Creating custom solutions such as a custom upload to a document library in SharePoint exposes some features that are very useful out of box, but problematic in our solution. One of these features that we recently discovered is Document Property Promotion.  Basically, upon calling SPFile.SaveBinary(), properties within Office documents are automatically extracted and saved to the list item’s corresponding columns in the document library. The issue we were running into was that the properties that we save during our custom upload process were being overwritten by the document’s properties.

The solution is to set SPWeb.ParserEnabled = false like below:

[code language=”csharp”]web.ParserEnabled = false;
web.ParserEnabled = true;

However, we realized that this fails when the user that is logged in executing this code does not have administrative permissions. In the end, what worked for us was storing the custom programatically saved SPListItem properties before calling SPFile.SaveBinary() and then reapplying them after SPFile.Item.Update().