如何在Windows表单应用程序中集成STSADM命令
-
09-12-2019 - |
题
我正在开发一个Windows表单应用程序,它将有一个选项作为“导出一个站点”,另一个选项,另一个选项“导入站点”我希望它可以使用以下stsadm命令完成,但不确定我需要添加什么按钮单击事件(C#),以便执行STSADM命令。
stsadm.exe -o export - url https://abc20.dev.com/cl / asdjsa / default.aspx -filename c:\ export.cab -IncludeUsecurity-versions 4 -overwrite
编辑这适用于我
.Process exportSite = new Process(); string commonFilesPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonProgramFiles); string commandLine = " -o export -url " + SPContext.Current.Web.Url + " -filename c:\\" + tempName + ".exp -overwrite -includeusersecurity"; exportSite.StartInfo.UseShellExecute = true; exportSite.StartInfo.FileName = commonFilesPath + @"\Microsoft Shared\web server extensions\12\BIN\" + "stsadm.exe "; exportSite.StartInfo.Arguments = commandLine; exportSite.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; exportSite.Start(); exportSite.Close();
解决方案
我很确定 system.diagnostics.process.start()会让您从.NET代码运行Stsadm。