Hi,
In our Sharepoint 2010 application we have some custom code that copies documents between site collections. Recently, one line of code has started to cause serious trouble:
SPList mylist = web.Lists["My
documents"];
SPListItem item = mylist.GetItemById(someintegerID);
byte[] bytes = item.File.OpenBinary(); //Here be serious trouble
the third row of code above, OpenBinary(), will randomly delete metadata from the listitem "item"! Even though the item is only supposedly read. We are never in any way doing any update to that listitem, we only use the bytes
to create another item in a completely different site collection further down in the code.
This behaviour is not repeted in all our environments, currently only on our build server and test environment. We are trying to find out how they differ, we suspect that OWA and different patches might be involved.
Can anyone please help with this? What could it be?
Some notes:
- This behaviour can be observed by just running the above three lines of code in a console application on the affected servers
- The metadata will not be deleted for a pdf document in the same list, it seems to affect office documents like Word and Excel files.
- It happens specifically on the method call to OpenBinary(), not later, not before
- A custom content type is the only content type allowed for the affected list, this content type has som fields of its own, it also inherits some fields from a parent content type which is also a custom content type. The list item/document has this content type set and that does not change.
--FG--