I want to check if outlook is installed on given machine and configured for current user. I am using below code...
private static bool IsOutlookProfileConfigured2()
{
try
{
RegistryKey currentUser = Registry.CurrentUser;
RegistryKey regWMSprofile = currentUser.OpenSubKey
(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles");
if (regWMSprofile == null)
{
regWMSprofile = currentUser.OpenSubKey
(@"Software\Microsoft\Office\15.0\Outlook\Profiles");
if (regWMSprofile == null)
{
return false;
}
Console.WriteLine(@"Found on path==>Software\Microsoft\Office\15.0\Outlook\Profiles");
}
else
{
Console.WriteLine(@"Found on path==>SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles");
}
Outlook.Application OlApplication = new Outlook.Application();
if (regWMSprofile.SubKeyCount > 0)
{
if (OlApplication == null)
{
return false;
}
Outlook.NameSpace olNameSpace =
OlApplication.GetNamespace("MAPI");
if (olNameSpace != null && olNameSpace.Accounts !=
null && olNameSpace.Accounts.Count > 0)
{
return true;
}
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
return false;
}
method is saying outlook profile is found at "Software\Microsoft\Office\15.0\Outlook\Profiles".
Outlook 2013 is installed on users machine but not configured.
so this method opens outlook profile configuration wizard.
Can anyone help me with fixing this function or some sample code that will check if outlook is configured for current user and should not start profile configuration wizard.
Thanks in advance.
If you find any folder inside this 'Profiles' folder, then the Outlook is configured for the current user.
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles
Check link:- How to detect whether Outlook is configured on machine using Regis