I've been asked to run the following command from C#:
stsadm -o gl-copylist -sourceurl "http://someurl" -targeturl "http://someurl" -includeusersecurity -haltonfatalerror -deletesource -includedescendants All –nofilecompression
Here is the code:
ProcessStartInfo startInfo = new ProcessStartInfo()
{
WindowStyle = ProcessWindowStyle.Normal,
FileName = "cmd.exe",
Arguments = "/C " + command,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true
};
The command runs fine in a stand-alone command window, but always displays the standard "STSADM -o" help text when run from my console app.
Any idea why??
The gl-copylist command is an add-in to the standard SharePoint STSADM command. Could this be the reason? Other standard STSADM commands run in my code.
It seems there is an error in method that parses/validates command line arguments in
stsadm
assembly, in particular whenincludedescendants
parameter that accepts value is specified before another parameter the following error occurs:Once the
includedescendants
parameter is specified as the last one, the command is executed successfully: