Document library - changing a file extension
Hi, Our SharePoint solution currently assigns a unique id to every document in a document library. End users are wanting to save their old .doc, .xls files etc as .docx, .xlsx etc. and retain their current ID (and to also avoid confusion of multiple documents). Can you see any issues with doing the following: - copy the document locally and save it as Office 2007 format - change the extension in SharePoint explorer view to the appropriate 2007 extension - upload the local 2007 document as a new version I understand that any references to the document URL will break and that there may be issues when they try to view previous versions. Any other problems that I may not be aware of?
February 15th, 2011 8:32pm

It's a little hokey, but it'll work. You may however be faced with thousands of documents to be updated in this way which could be very time consuming. I would recommend writing a quick script that can leverage the SharePoint APIs and the Office APIs to do the same thing through code in a supported way. Since document libraries are just lists with attachments, you can iterate the library and get a reference to the attachment for each document. You can then simply use the Office APIs to open the attachment and save it in the ???x format and then replace the attachment with the new file. The only potential glitch might be if the version history actually ties to the file name and not the doc ID, but you can test that with your manual test very easily. If you do it and you can still access the version history, then you're OK. If the version history suddenly disappears though, your code will have to iterate through the version history of the document and save each version off to disk. Then using the Office APIs you'd have to convert all the saved versions and then replace the first version over the existing doc attachment followed by programmatically uploading every subsequent version to the library as a new version. I trust that answers your question... Thanks C http://www.cjvandyk.com/blog
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2011 12:13pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics