Home > 2007 > How to Integrate STSADM command within Windows Form App

How to Integrate STSADM command within Windows Form App

August 3Hits:2
Advertisement

I am developing a Windows Form Application which will have one option as "Export a Site" and another to "Import a Site" I want it to be done using following STSADM commands but not sure what I need to add in button click event (C#) so that it will execute a STSADM command.

stsadm.exe -o export -url https://abc20.dev.com/cl/asdjsa/default.aspx -filename C:\Export.cab -includeusersecurity -versions 4 –overwrite

Edit this worked for 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(); 

Answers

I'm pretty sure System.Diagnostics.Process.Start() would let you run STSADM from .NET code.

Related Articles

  • How to Integrate STSADM command within Windows Form AppAugust 3

    I am developing a Windows Form Application which will have one option as "Export a Site" and another to "Import a Site" I want it to be done using following STSADM commands but not sure what I need to add in button click event (C#) so

  • Why doesn't the Windows command prompt window maximize to the full screen size?

    Why doesn't the Windows command prompt window maximize to the full screen size?December 7

    Anyone know why doesn't the Windows command prompt window maximize to the full screen size? To the best of my knowledge, even in the new Windows 7 the command prompt window(cmd.exe) doesn't maximize to the full screen size like all other windows. Thi

  • How can I start Norton Commander on Windows 7?March 10

    Is it installed by default? If yes, how can i started it. If no, how can I installed it? ADDED: I need something free. --------------Solutions------------- You can download and install Norton Commander from here. Instead of Norton Commander, I recomm

  • What is the best way to hide a command prompt window

    What is the best way to hide a command prompt windowMarch 17

    I'm running the headless interface of VirtualBox (VBoxHeadless.exe) with Ubuntu Server running on it. Every time I run VBoxHeadless, it starts a command prompt window which just sits on the taskbar taking space which could have been used by more usef

  • How can I stop new Command Prompt windows spawned by another program from covering my foreground window?April 12

    Under Windows 7 x64, when I'm ripping CDs with Exact Audio Copy, it spawns a Command Prompt window each time it invokes the external MP3 compression program I use, LAME. While that's going on, I usually like to surf the web. However, I find it quite

  • Access denied using the STSADM commandJune 17

    I am unable to use the STSADM command. When i try to use it, it shows me access denied. I am the admin of my system, but still I am getting access denied. --------------Solutions------------- Are you running Server 2008? If so, you need to open the c

  • A good list of command line *nix like apps for windows?August 27

    I'm looking for a list of command line *nix like apps for windows. I suppose gnuwin32 is a good idea, and cygwin... Each give a good list. any other ideas? I know sometimes there are good programs that aren't GNU, and aren't yet ported to cygwin(the

  • Windows 7 - Open Command Prompt WindowSeptember 23

    The CMD function is supposed to open a new command prompt window, however in Windows 7, it opens another inside of the existing one so if you typed in exit, it will simple exit the most recent one started. Is there a way to make CMD open a new window

  • Why is the "at" command on Windows XP not behaving as expected?October 2

    On Windows XP I'm trying to add a job like this: at 17:07 /every:s dir I expect dir to be executed every Saturday at 17:07, however I don't see anything happens in the command line window. Here is the log: D:\temp>at 17:07 /every:s dir Added a new jo

  • How to execute a scheduled task with "schtasks" without opening a new command line window?October 3

    I have a batch file that creates a scheduled task using schtasks like this: schtasks /create /tn my_task_name /tr "...\my_path\my_task.bat" /sc daily /st 10:00:00 /s \\my_computer_name /u my_username /p my_password It works OK except the fact th

  • Open a command line window in GNOME DesktopDecember 19

    In GNOME Desktop, when I type /usr/bin/firefox, the Firefox browser will open. How can I open a command line window in the same way? --------------Solutions------------- Use GNOME Terminal: /usr/bin/gnome-terminal

  • Sleep command in windows server 2008December 23

    I'm going to write a batch script in windows server 2008. The script is a general windows commands and it needs waiting for few minutes before executing the next line of the script somewhere in the middle. When I tried sleep, it said command not foun

  • Adding a web folder via command line (Windows) January 5

    Possible Duplicate: How to add a web folder via command line (Windows) I am trying to add a web folder via command line in windows. At first I though I should use the "net use" command, but when I tried I kept getting System error 67: C:>net

  • Alias Command for WindowsApril 11

    While at work, I want to use the CLI to be more productive on my Windows machine. What command, in Windows, would be a replacement for the alias command? --------------Solutions------------- doskey com=a long command $* Here $* expands to everything

  • What is the equivalent to the Linux File command for windows?April 18

    Running the command: file run.sh Gives me: run.sh: Bourne shell script text executable in Linux. Is there an equivalent command in Windows? --------------Solutions------------- There probably isn't one on your system by default. You could install the

  • Collecting the output from a command in Windows from users that are not computer savvyMay 13

    I was wondering what is the easiest way to collect the output from a command in Windows from users that are not computer savvy. E.g. For example, If I need to collect the output from ipconfig from 20 people, I would like to have something that allows

  • Total Commander on Windows 7 with Administrative PrivilegesMay 13

    I'm running Total Commander on Windows 7 and I have a problem with the Run as Administrator issue. If I run TC normally, it can't make changes to anything under C:\Program Files\ without asking for permissions. If I run TC as Administrator, Windows a

  • Is there a Keyboard shortcut to close a Command Prompt window?May 27

    Is there any keyboard shortcut to close the Command Prompt window in Windows 7? Alt+F4 does not seem to work on a Command Prompt window. I close it right now by typing exit and Enter at the prompt. Hoping there is a shorter trick. --------------Solut

  • Change file open command in Windows 7?July 11

    When I install Paint .NET, it creates the Edit in the context menu file for .PNG and other file types. However, when I install ACD See, it suddenly change the program for Edit command. Windows Paint is opened instead of Paint .NET. I also uninstall A

  • Windows Command Prompt: How to change the size of command history window?July 26

    Pressing F7 in the Windows command prompt window displays a console window with the command history (list of previous commands). How do I change the size of this command history window? For example, I might want to see more commands (increase height

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.640 s.