How to Open Outlook Automatically using C#

If you are automating outlook, it is good practice in your C# program to ensure that outlook is opened. If outlook is not opened, your code will not work as expected. Below C# code snippet checks that outlook is open or not. If it is running then it’s ok otherwise it will open outlook automatically.

You must use this code before you call the function to automate any outlook task.

public static void OpenOutlookIfNotOpened()
{
 if (Process.GetProcessesByName("OutLook").Length < 1)        
   {
      Process.Start("OutLook.exe");
   }
}

Leave a Reply