Posts

Showing posts from May, 2009

Trim sharepoint's documents

I've come across a strange problem. I download a physical document from the sharepoint custom document library add this document back to the same library - it throw the error "Office document cannot be updated". When I add a document which was created not in the sharepoint - everything were ok. I've investigated deeply this problem and found that when you get a physical document from your custom document library it exported together with fields of the content type. These fields wrote into custom document properties of the document. I foung only one way to get rid of them - use microsoft COM library - word automation(Microsoft.Office.Interop.Word). object path = "Path to file goes here"; object missing = Missing.Value; object readOnly = false; object isVisible = false; object itemProp; Type typeItemProp; Word.Application wApp = new Microsoft.Office.Interop.Word.ApplicationClass(); Word.Document wDoc = wApp.Documents.Open(ref path, ref missin