The title pretty much says it.
My target is to deploy a custom alerttemplates.xml to my SharePoint 2010 solution programmatically. Which would decrease the steps for an installation of the solution, since this gets done automatically when the feature gets activated.
The only Problem, this doesn't work as it should be. That's what I've done: I've created a method to execute stsadm operations from within my code; the critical part is: (Note: Normally, the arguments(string) is created dynamically and is a parameter of the method; Not shown here for simplicity, but that's how it would look like.)
string prgFilePath = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
+ @"\common files\microsoft shared\web server extensions\14\bin\stsadm.exe";
string arguments = "-o updatealerttemplates -url http://spserver/ "
+ @"-filename + C:\custom\alerttemplates.xml";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = prgFilePath;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Arguments = arguments;
worked = proc.Start();
proc.WaitForExit();
When I use the SharePoint Management-Shell and do it manually "stsadm -o update[...]" this works just fine. But this doesn't seem to work, and I can't figure out why.
Did I forget something? Is this the wrong way to do it? (Call Powershell instead and call the stsadm.exe) I'm not quite sure what to do here since I rarely work with stsadm.exe/(Power)shell related stuff. I'm just the guy that uses Visual Studio. :)
Could it be an issue that the paths in the Verbatin-strings (@"") get translated and ultimately send to the stsadm.exe as "C:\custom\alerttemplates.xml"? (Normally that's no issue, I know. But maybe, maybe in this case it is?)
I'd really appreciate when someone could give me hint on that matter.
Also: What's with filepaths that have blank spaces? Just set " in front and at the end?