Posts

Showing posts from February, 2010

Trim Sharepoint documents part 2.

As I wrote I came across the problem of uploading documents to sharepoint library which were downloaded from it before. The document content is created at sharepoint ok, but when I try to update metadata - sharepoint throws COMException (0x81071003). After digging in this problem it was found out that the document contains old data of content type within its custom properties. As I wrote in the previous topic - this problem can be solved by using ms office interop libraries, but this is the problem when you don't have ms office installed. I've found another good solution for the problem - DSOFile. It's a microsoft library which allows managing document custom properties. DSOFile.OleDocumentProperties dso = new DSOFile.OleDocumentProperties(); dso.Open(file, false, DSOFile.dsoFileOpenOptions.dsoOptionDefault); foreach (DSOFile.CustomProperty item in dso.CustomProperties) {     item.Remove(); } Library can be downloaded here http://support.microsoft.com/kb/224351