Well that's all that matters in the long run. :) Regards,
Paul Noone SharePoint Farm Admin/Developer Infrastructure Team CEO Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: [email protected] w: http://www.ceosyd.catholic.edu.au/ On 15 May 2013 16:26, Nigel Witherdin <[email protected]> wrote: > Hey Paul, > > The commented code was setting the Content Type properties in a hashtable > and applying that on file upload, but no that wasnt working. I suspect the > Office 2003 doc was then promoting its properties to SharePoint and > overwriting this setting. > > My code then goes processes a CSV (for original property data for each > item from the old DMS), XML (for data mapping conversions of these old > values to new SharePoint property values), and a huge switch statement that > sets the new property value for different types of SharePoint columns, > updating the item after ever property value had been set. > > I found that if I then re-set the content type setting after all of this > done, the content type setting stuck (I assume this is occurring after the > document had promoted its properties). > > Like I said, probably not the most efficient thing in the world, but its > working now :D > > Cheers, > > Nigel > > ------------------------------ > Date: Wed, 15 May 2013 15:57:23 +1000 > Subject: Re: Issues Uploading Office 2003 docs to SP 2010 Programmatically > From: [email protected] > To: [email protected] > > > Nigel, > > In my experience you need to set the properties before adding the file, > which your commented code was already doing. > > Did that not work for you? > > Regards, > > Paul > > > On 15 May 2013 13:55, Nigel Witherdin <[email protected]> wrote: > > Ok - have come up with a kludge of a fix. > > I upload the file, get the item, set the content type, set all the > metadata then get the item again and set the content type again. This time > the content type setting seems to stick. > > Yay - only took a few additional round trips to the database to re-get the > item, re-set the content type....maybe not so yay after all > > Oh well, at least it works now ;) > > > ------------------------------ > From: [email protected] > To: [email protected] > > Subject: RE: Issues Uploading Office 2003 docs to SP 2010 Programmatically > Date: Wed, 15 May 2013 02:15:18 +0000 > > > I thought setting the ParserEnabled to false would prevent any property > promotion/demotion. See - > http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.parserenabled.aspx > and > http://sharepointserver-2007.blogspot.com.au/2012/04/sharepoint-spweb-property-parserenabled.html > > But unfortunately, Office 2003 docs are still ruining my day.... > > > > ------------------------------ > From: [email protected] > To: [email protected]; [email protected] > Subject: RE: Issues Uploading Office 2003 docs to SP 2010 Programmatically > Date: Wed, 15 May 2013 01:05:55 +0000 > > Promotion of properties is my daily nemesis these days. I share your > pain. > > In the past I used to overcome this by uploading using the frontpage RPC – > which allows you to set the promoted properties in XML before sending it to > the site. However, it is cumbersome to use, and the object model should do > what it is told! > > > > > [image: Description: Description: C:\Users\Brian\Pictures\EXD > Logos\Extelligent logo no text.jpg]*Ishai Sagi* | Solutions Architect > 0488 789 786 | [email protected] | www.sharepoint-tips.com | > @ishaisagi<http://twitter.com/ishaisagi> > | MVP Profile <https://mvp.support.microsoft.com/profile/Ishai> > > *From:* [email protected] [mailto:[email protected]] *On > Behalf Of * Nigel Witherdin > *Sent:* Wednesday, 15 May 2013 10:37 AM > *To:* OzMoss; Conrad Grobler > *Subject:* Issues Uploading Office 2003 docs to SP 2010 Programmatically > > 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 > > _______________________________________________ ozmoss mailing list > [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > _______________________________________________ > ozmoss mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > > > _______________________________________________ ozmoss mailing list > [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > _______________________________________________ > ozmoss mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > >
<<image002.jpg>>
_______________________________________________ ozmoss mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
