Get Current Outlook version installed and Current configured Email ID in C#.net

InfoPath alternatives for form designing SharePoint
In this post we will discuss how to get Current Outlook version installed and Current configured Email ID in C#.net. Also you can check out my previous posts on:
Here is the code to retrieve the current outlook version installed like outlook 2003 or Outlook 2007 in C#.Net etc.
 public static string GetOutlookVersion()
       {
           Microsoft.Office.Interop.Outlook.Application applicationObject = new
Microsoft.Office.Interop.Outlook.Application();
           return applicationObject.Version;
       }
The following code gives you the current configured email id for outlook.There will be no issues whether it will be a POP3 account or it may be an exchange server account.
 public static string GetCurrentUser()
       {
           string currentUser = string.Empty;
           try
           {
               RDOSessionClass session = new RDOSessionClass();
               session.Logon(“”, “”, false, false, null, false);
               RDOAccounts accounts = session.Accounts;
               foreach (RDOAccount account in accounts)
               {
                   if (account.AccountType == rdoAccountType.atPOP3)
                   {
                       currentUser = session.CurrentUser.Address;
                   }
                   else if (account.AccountType == rdoAccountType.atExchange)
                   {
                       currentUser = session.CurrentUser.SMTPAddress;
                   }
               }
           }
           catch (System.Exception ex)
           {
           }
           return currentUser;
       }
You can try out more for any further need like if multiple accounts have been configured.

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply