SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web service that shows a sort of CRUD of document (with metadata) for other application..

I have some document libraries in which users can upload (via WS) documents with metadatas.

For every kind of documents the upload of a new file works fine but when I upload new versions of particular file (DOCX, PPTX..) the metadata disappears in the new versions!

So.. how can I fix this problem? Is a well known bug or something new I have found?

Thank you very much!

share|improve this question

check this link out on msdn forum as its the same question:

For the ones (.docx / .xlsx) if you add metadata; you download the document and upload it back again you will notice the field values will be pre-populated and this is because of XML promotion and demotion. To verify this:
Step 1: change the extension of your .docx or .xlsx to .zip
Step 2: Open the zip file and look for a folder customXml
Step 3: Open the folder and look for a file Item1.xml
When you open the file you will notice that the properties have the same values as were assigned when you first uploaded the document. This is the exact reason why you get the fields pre-populated once you upload this document. The above process is what is called as XML promotion and demotion. Hope this gives you an idea on what this is.

Note: The above steps won't be true for .doc or .xls, for these types of documents you will notice that fields are always empty.

share|improve this answer
up vote 0 down vote accepted

I solved my problem simply "rewriting down" the data inserted in the old item field.

Supposing my custom columns are:

  • tt_file_id
  • tt_content_id
  • tt_Name

The code is:

SPListItem oldItem = list.GetItemById(OldItemID);
SPListItem newFile = (list.RootFolder.Files.Add(oldItem["Name"].ToString(), filebytes, true)).ListItemAllFields;

string Name = oldItem["Name"].ToString();
newFile["tt_file_id"] = oldItem["tt_file_id"];
newFile["Name"] = oldItem["Name"];
newFile["tt_content_id"] = oldItem["tt_content_id"];

share|improve this answer

Your Answer


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.