Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Calling console application from crm plugin

$
0
0

Hello,

I am trying to call a simple console application  from a crm 2011 plugin on post update.

This is the code from my plugin:

                StreamReader output = null;
                StreamReader error = null;
                try
                {
                    Process p = new Process();
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = @"D:\TotalSoft\ConsoleApplication8\bin\Debug\ConsoleApplication8.exe";
                    p.StartInfo.Arguments = (string)entity.GetAttributeValue("ts_status");
                    p.Start();
                    p.WaitForExit();
                    output = p.StandardOutput;
                    error = p.StandardError;
                }
                catch (Exception ex)
                {
                    Entity qm = new Entity("new_lmtinterfacelog");
                    qm["new_errormessage"] = "There was an error when trying to call the backloop application. Exception: " + ex.Message + "---StackTrace: " + ex.StackTrace + "---StandardError: " + error.ReadToEnd() + "---StandardOutput: " + output.ReadToEnd();
                    qm["new_name"] = "Backloop exception";
                    service.Create(qm);
                }

Every time i trigger a post upodate i get the error: Cannot find file specified and the address is correct(@"D:\TotalSoft\ConsoleApplication8\bin\Debug\ConsoleApplication8.exe").

Any ideas guys???

tnx


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images