Follow us on X (Twitter)  Like us on Facebook  Connect with us on LinkedIn  Subscribe to our YouTube Channel  Subscribe to our WhatsApp Group

On various scenarios, especially when you are building and shipping Add-Ins for outlook, at the time of add-in installation you might want to check whether user has installed outlook on his system or not. Based on that, you might want to show a message to the user.

 

In this small blog post, we will learn what needs to be done using C# to find out whether outlook is installed or not. Continue reading to know about this coding tricks.

 

How to check whether #Outlook is installed in user machine? (www.kunal-chowdhury.com)

 

It’s easy to check manually whether outlook is installed or not. But this does not work all time. If you are building an add-in, you must ship the DLL as an installer and in that case, it is require to check the availability of the outlook app just before the installation.

 

There are various ways to do so and one of the trick is to play with the Windows Registry to find out whether outlook is installed, We will not go in this way as that is little more lengthy. Why to go in a difficult way, when we already have a simple coding trick.

 

Every office app has a Prog ID and you can retrieve it by calling GetTypeFromProgID method of the abstract class Type and passing the parameter of the office application name. GetTypeFromProgID gets the type associated with the specified program identifier. If progID is a valid entry in the registry and a type is associated with it, that means that the said application is present in that system; otherwise not.

 

Here is the code snippet for your reference:

 

var officeApplicationType = Type.GetTypeFromProgID("Outlook.Application");
      
if (officeApplicationType == null)
{
   // Outlook is not installed in user's system
}
else
{
   // Outlook is installed in user's system
}

 

Make sure that, you have referenced the DLL: Microsoft.Office.Interop.Outlook in your project; otherwise this will not work.

 

I hope that, though it’s a small post but will help you to do the same in your project and you can do this very easily after reading and understanding the code shared above. Don’t hesitate to ask your question. I will try to help you as soon as possible. Connect with me over social networking sites like Twitter, Facebook, Google+ to receive all the updates that I share there. Happy coding!!!

 

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.