How to run Outlook using Process.Start(“outlook.exe”) and get the control back

前端 未结 5 863
难免孤独
难免孤独 2021-01-26 15:42

My C# program needs to launch Office Outlook and get the current \"running outlook application\". In order to do that I\'ve implemented the following simple program (so if you w

5条回答
  •  我在风中等你
    2021-01-26 16:05

    This works:

    public static void StartOutlookIfNotRunning()
    {
        string OutlookFilepath = @"C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE";
        if (Process.GetProcessesByName("OUTLOOK").Count() > 0) return;
        Process process = new Process();
        process.StartInfo = new ProcessStartInfo(OutlookFilepath);
        process.Start();
    }
    

提交回复
热议问题