Stsadm 导入导出子站点

SharePoint通过stsadm备份和还原子网站(不是网站集)

 

大家都知道SharePoint的stsadm命令提供了很多便捷甚至是唯一的操作方法!
这里列出的所有命令:http://www.cnblogs.com/dadongzuo/archive/2013/05/21/3091043.html


在这里,我要单独说export/import这2个命令,主要是用于导出导入子站点时使用的。(由于曾经被这个问题折腾过,又忘了,所以这次准备记录下来,也让大家少走弯路)

例如:
https://dms.demo.com.cn/sites/MT2/Guangzhou%20%20HZCLTS/ 
要迁移到
https://dms.demo.com.cn/sites/MT2/test0608/

注意,这个来源子站点名称是”beijing zhongguo” 中间有2个空格URL里自动加上了替换符%20


Export脚本如下:

@SET STSADM="C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BINSTSADM.exe" 
%STSADM% -o export -url "https://dms.demo.com.cn/sites/MT2/Guangzhou  HZCLTS/" -filename Guangzhou%20%20HZCLTS.dat -includeusersecurity -versions 4 
pause 

执行成功!注意上面红色部分中间的空格不要使用%20,否则会报错!(类似的特殊符号啥的也要自己把它改回为子网站名)并且Sharepoint不会告诉你是这个错,会告诉你只能在网站集或者网站使用此命令!你就会疑惑明明我这就是子网站呀。呵呵。。我敢说用这个命令不成功的人基本都是这个问题

Import脚本如下:

@SET STSADM="C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BINSTSADM.exe" 
%STSADM% -o import –url "https://dms.demo.com.cn/sites/MT2/test0608/" -filename Guangzhou%20%20HZCLTS.dat -includeusersecurity -updateversions 2
pause



PS:


命令格式:
stsadm
-o export 
-url <URL to be exported>
-filename <export file name>
[-overwrite]
[-includeusersecurity]
[-haltonwarning]
[-haltonfatalerror]
[-nologfile]
[-versions <1-4> 1= Last major version for files and list items (default), 2= The current version, either the last major or the last minor, 3= Last major and last minor version for files and list items, 4= All versions for files and list items]
[-cabsize <integer from 1-1024 megabytes> (default: 25)]
[-nofilecompression]
[-quiet]

stsadm
-o import 
-url <URL to import to>
-filename <import file name>
[-includeusersecurity]
[-haltonwarning]
[-haltonfatalerror]
[-nologfile]
[-updateversions <1-3> 1= Add new versions to the current file (default), 2= Overwrite the file and all its versions (delete then insert),3= Ignore the file if it exists on the destination]
[-nofilecompression]
[-quiet]

原文地址:https://www.cnblogs.com/TNSSTAR/p/3186586.html