大家都知道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/
注意,这个来源子站点名称是"Guangzhou%20%20HZCLTS” 中间有2个空格URL里自动加上了替换符%20
Export脚本如下:
@SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.exe"
%STSADM% -o export -url "https://dms.demo.com.cn/sites/MT2/Guangzhou HZCLTS/" -filename Guangzhou%20%20HZCLTS.dat -includeusersecurity -versions 4
pause
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
执行成功!注意上面红色部分中间的空格不要使用%20,否则会报错!(类似的特殊符号啥的也要自己把它改回为子网站名)并且Sharepoint不会告诉你是这个错,会告诉你只能在网站集或者网站使用此命令!你就会疑惑明明我这就是子网站呀。呵呵。。我敢说用这个命令不成功的人基本都是这个问题
Import脚本如下:
@SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.exe"
%STSADM% -o import –url "https://dms.demo.com.cn/sites/MT2/test0608/" -filename Guangzhou%20%20HZCLTS.dat -includeusersecurity -updateversions 2
pause
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
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]