Thursday, July 9, 2009

Extract Blobs from a WSS Database List? C# or VB?

In VB OR C#, I need to extract data that is currently blobs that were files uploaded by WSS 2.0. WE are converting to WSS 3.0 and I don't want to manually save each file (we are talking .doc, .xls, .eml) to a folder then edit the file properties in the list that has been moved to the new WSS 3.0 location. I'm currently working with a test server so I can screw it up and start again, however the files that need to be extracted are on a live server. I've not worked with VB in years (and what I did was VERY basic) and I've never worked with C#. Any suggestion or information locations would be great.

Extract Blobs from a WSS Database List? C# or VB?
SPSite mysite = new SPSite("http://localhost") // replace localhost with the URL of your site


SPWeb myweb = mysite.OpenWeb();


SPFolder mylibrary = myweb.Folders["Name of library"];


SPFileCollection files = mylibrary.Files;





"files" now contains a collection of files from your document library. You can iterate through them, copy them, basically do what you want with them.


No comments:

Post a Comment