Checking for Outlook window

Hello everyone,

I’m trying to check if Microsoft Outlook is already started on a PC or not.
I tried to use the Get Processes method and after that a For Each Loop to look through all processes.
But the Condition I’m searching becomes never true:
process.ToString.Contains(“Outlook”)
It works with “iexplore” to finde the Explorer but i cant find the right name for Outlook.

Use attach window within try catch and indicate the selector to your outlook window.
If the control goes to catch block, that means the window is not open. otherwise window is open.

In other ways, to make sure there is no conflict, execute kill process on outlook and then start the process.

2 Likes

Hi, you can also use this command: Process.GetProcessesByName("outlook").Length

if it’s open and running it will return 1, otherwise it will return 0. My recommendation is that, if possible, avoid using user interface for office applications

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.