Hi All,
We are using an in-house developed tool to upload files from old DMS into
SharePoint 2010, and are finding we are having issues with Office 2003 docs.
The tool uploads the file, sets content type, and then set metadata (as read
from a CSV). This all works fine for PDFs, DOCXs, etc. but it does not work
with DOCs. Frustratingly, it doesn't report any errors, and the logging info
looks just fine for these files.
Instead of being set to the specified content type, they are always set to the
default content type of the library, and do not have the metadata values set as
expected.
The code being used to upload the file and set the content type (both ways it
has been tried) is:
targetList.ParentWeb.ParserEnabled = false;
targetList.ParentWeb.Update();
//Hashtable ht = new Hashtable();
//ht.Add("ContentTypeId", targetCt.Id.ToString());
//ht.Add("ContentType", targetCt.Name);
//SPFile file = targetFolder.Files.Add(filename, fs, ht, true);
//file.Update();
SPFile file = targetFolder.Files.Add(filename, fs, true);
file.Update(); file.ParentFolder.Update();
file.Item[SPBuiltInFieldId.ContentTypeId] = targetCt.Id;
file.Item[SPBuiltInFieldId.ContentType] = targetCt.Name;
file.Item.UpdateOverwriteVersion();
targetList.ParentWeb.ParserEnabled = true;
targetList.ParentWeb.Update();
I have done some googling on the issue, and can see that other people have had
different issues with SP 2010 and Office 2003, but nothing that definitively
states there is an issue loading these files programmatically (and setting CT
and metadata).
I have been able to quite happily load the file manually, and set CT and
metadata.
I suspect the properties in the DOC files are promoting and overwriting the
values set against the item by the tool, but cant find anything to prove this
(no additional versions in history etc).
Whilst I could convert the DOCs to DOCXs, as these are legal documents, I
suspect there will be restrictions in place that they must be unaltered.
Has anyone suffered anything similar? Any solutions/code samples would be
greatly appreciated
Cheers,
Nigel _______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss