Come integrare il comando STSADM all'interno dell'app Form Windows
-
09-12-2019 - |
Domanda
Sto sviluppando un'applicazione di moduli di Windows che avrà un'opzione come "Esporta un sito" e un altro su "Importa un sito" Voglio essere fatto usando i seguenti comandi STSADM ma non sono sicuro di cosa ho bisogno per aggiungere il clic sul pulsanteEvento (c #) in modo che eseguirà un comando di stsadm.
.stsadm.exe -o export -url https://abc20.dev.com/cl / asdjsa / default.aspx -FileName C: \ Export.cab -IncludeuseSecurity -VERSIONS 4 -OOTWRITE
Modifica Questo ha funzionato per me
.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();
Soluzione
Sono abbastanza sicuro che System.Diagnostics.Process.Start () ti consentirebbe di eseguire Stsadm dal codice .NET.