2

I need to run a console application within the execute method of a timer job in SharePoint 2010. Please guide me to do this by providing samples or links or hints.

  • 2
    A console app doesn't seem like the right solution.could you explain a bit about what you are trying to do – Anders Rask Nov 30 '11 at 6:57
3

Not sure why you would want to run an external application from a SharePoint timer job, however, you could try using the Process() class in C# (this isn't a SharePoint-specific example, but is how you launch external processes from .NET code):

Console.WriteLine("Running"); 
Process pr = new Process(); 
pr.StartInfo.FileName = "Notepad.exe"; 
pr.StartInfo.Arguments = "test.dat"; 
pr.Start(); 
while (pr.HasExited == false)
     if ((DateTime.Now.Second % 5) == 0)
     { // Show a tick every five seconds.
         Console.Write(".");
         System.Threading.Thread.Sleep(1000);
     }

Sample from: http://omegacoder.com/?p=119

I'm not sure if SharePoint will allow this, but it's worth a shot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.