Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
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
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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