STSADMExtractFiles is a sample application that extends the STSADM.EXE command line via the ISPStsadmCommand interface and adds three new commands to the tool: savefile, savefromfolder and restorefile. The purpose of the sample is to show how an application could be built to extract content out of a SharePoint content database to the file system in order for the content (aspx files etc..) to be saved into a source control system.
These commands allow the user to save content from a SharePoint site directly to the file system and restore a file back to the SharePoint.
The sample uses the WebPartPagesWebService (from _vti_bin/WebPartPages.asmx) to retrieve the file content. This is the same web service that SharePoint Designer uses. The sample uses Regular Expressions to remove some of the SPD specific attributers when saving the file. For restoring the file it uses the FrontPage RPC put_document command.
The SaveFromFolder command allows you to point to a starting folder and extract all of the files recursively to the file system.
stsadm -o savefromfolder -weburl <url to SharePoint web> -localworkingdirectory <path where content will be saved> -starturl <relative url to folder on site where to start save from ( / for root)> [-skipcheckedout <skip files that are checked out>] [-onlycustomized <only save files that are customized>] [-lastmodifieddate <only save files that are modified after this date>] [-lastmodifiedby <only save files that are last modified by the specified user (Modified By in SharePoint Designer)>] [-nofilecompare <forcibly save files without comparing existing files first>] [-fileextension <only save files with the specified file extension>] [-skipemptydirs <skip creation of directories that do not contain files.>]
The end result of saving a test team site:
The SaveFile command allows you to save an individual file.
stsadm -o savefile -weburl <url to SharePoint web> -localworkingdirectory <path where content will be saved> -sourceurl <relative url of source file> [-nofilecompare <forcibly save file without comparing existing files first>]
The RestoreFile command allows you to restore a file from the file system back to the SharePoint site. Note - this is not full fidelity, it will not keep individual permissions etc.. it is really only useful for replacing content.
stsadm -o restorefile -weburl <url to SharePoint web> -localfilepath <path to source file> -targeturl <relative url to target file>
See the attached sample for the project/source to the sample. The readme.txt has full instructions on how to install the sample.
PingBack from http://blog.a-foton.ru/index.php/2008/11/20/how-to-extract-aspx-files-out-of-a-sharepoint-content-database/
Come noto, SharePoint Designer, nel momento in cui lavora “live” su un sito SharePoint, memorizza i file