Share and Enjoy !

If you were there when I lost access to my Picture Library in my at-home SharePoint site last weekend, you might have redirected me to this blog post listing out code which can help you retrieve data directly from a SharePoint content database.

See, my son is “student of the week” this week, and part of this honor is that he brings in his favorite pictures to post on the classroom bulletin board. And since we rarely actually “print” our photos, I needed to gather these together and submit to our favorite but rarely used online printer (Wolf Camera) for printing and then pickup that same day.

But, as luck would have it, I had accidentally shut down that server while an update was being applied. The server was running ‘headless’ (no monitor) and I didn’t realize it was installing updates when I killed the power.

Hey, its a home sandbox and takes a lot of abuse!

The end result was that the Windows SharePoint Services Web Application service would not start. I tried a handful of repair steps but it seemed to be getting worse instead of better, and I was running out of time on a Sunday afternoon.

Anyways, I’ve attached the source code which includes the most recently compiled exe which saved the the day.

To use:

restorefiles.exe [connectionString] restorefiles.exe Server=[ServerName];Database=[DatabaseName];Trusted_Connection=True restorefiles.exe Server=\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query;Database=wss;Trusted_Connection=True;

The utility will extract all documents from all document libraries in the specified content database. It will place these in folders, if you used a folder structure in your document libraries (which I did). Files are placed in the current working directory, where the exe is fired off, so be sure that you have space available. Be sure to test this utility on a small, simple database before going after a larger more important piece of work.

One curve ball was figuring out the correct [ServerName] to use for the SQL Server Express instance I’m using. To remedy, I installed SQL Server Management Studio Express (v9.00.2047) and used the SQL Server Configuration Manager to first enable Named Pipes and also to retrieve the exact name of the …named pipe (see snap below).


Hope that is helpful!

Share and Enjoy !

Related Content: