Link to home
Start Free TrialLog in
Avatar of jamorlando
jamorlandoFlag for United States of America

asked on

Export All Documents from Sharepoint

Hi,
I was wondering if there was a way from Sharepoint 2007 to somehow export all documents (.doc, .xls...etc...) from the database or backup file.

Say someone overwrites or deletes a document by accident.  In theory, I need to restore my entire Sharepoint databases to retrieve the document that was deleted (from the web front end).

Just seems a lot quicker/easier if there was a way to extract the deleted file from an old database backup.

Thanks for your help,
Jamie
ASKER CERTIFIED SOLUTION
Avatar of Radhakrishnan
Radhakrishnan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jamorlando

ASKER

Thanks, spiefolder seems to be really nifty and I noticed that it was recommended on some other boards as well.

SPList looks interesting, but it's $800 ... no thanks.
Please check out this thread for further discussion on the topic:
https://www.experts-exchange.com/questions/26557366/List-all-Sharepoint-Document-Libraries.html
I actually just finished writing a script (part powershell, part batch file) that uses the SPIEFolder utility.  It iterates a sharepoint site collection finds all document libraries and then runs the SPIEFolder utility for each document library.  Just tried it out and it works great.
I can't attach the code in a file, so I just pasted the code for both files below.
Enjoy (and use at your own risk)
You will need SPIEFolder too http://spiefolder.codeplex.com/ 


SHAREPOINT_DOCUMENT_EXPORT.bat

================================
@echo off
setlocal enabledelayedexpansion

REM Last editted by Jamie Orlando on 10/21/2010

REM ======================================================================================================
REM This script iterates through all the document libraries in Sharepoint and exports all documents
REM ======================================================================================================

set backUpFolder=D:\SHAREPOINT_DOC_EXPORT
set logFile=D:\SHAREPOINT_DOC_EXPORT\Export_Log.log

mkdir %backUpFolder%

echo. >> %logFile%
echo.============================== >> %logFile%
echo.%date% - %time% >> %logFile%
echo. >> %logFile%

echo.Generating DocLibList.txt >> %logFile%
powershell -command "& {D:\Backup\DocLibList.ps1}" >> %logFile% 2>&1
echo. >> %logFile%

for /f "tokens=1,2 delims=*" %%a in ('type DocLibList.txt') do (
   echo.%date% - %time%: Exporting %%a -- %%b >> %logFile%
   echo. >> %logFile%

   set sharepointSite=%%a/
   set sharepointSite=!sharepointSite:~17,100!
   set sharepointSite=!sharepointSite:/=\!
   set finalFolder=%backupFolder%
   set finalFolder=!finalFolder!!sharepointSite!
   set finalFolder=!finalFolder:~0,-1!

   D:\SPIEFolder\V3\SPIEFolder.exe "%%a" "%%b" "!finalFolder!" export >> %logFile% 2>&1
   echo.============================== >> %logFile%
   echo. >> %logFile%
)

echo.Deleting DocLibList.txt >> %logFile%
del DocLibList.txt >> %logFile% 2>&1
echo. >> %logFile%

echo.%date% - %time% >> %logFile%
echo.============================== >> %logFile%

DocLibList.ps1
==================================================
### Document Library Enumerate
###
### By: Jamie Orlando
### Modified: 10/21/2010
###
### Exports a list of Sharepoint sites and their document libraries to a text file


[void] [System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)
$siteurl = "http://sharepoint"
$mysite=new-object Microsoft.SharePoint.SPSite($siteurl)

foreach ($CurrentSite in $mysite.Allwebs)
{
   foreach ($CurrentList in $CurrentSite.Lists)
   {
      if ($CurrentList.BaseTemplate -eq "DocumentLibrary")
      {
         $OutputString = ($CurrentSite.Url + "*" + $CurrentList.Title)
         $OutputString | Out-File "DocLibList.txt" -Append
      }
   }
}