ACAT.Lib.Extension.AppAgents.Outlook.OutlookAgentBase.getOutlookVersion C# (CSharp) Method

getOutlookVersion() protected method

Returns the outlook version install on the client machine. 14.0 is Outlook 2010
protected getOutlookVersion ( ) : int
return int
        protected int getOutlookVersion()
        {
            RegistryKey key = null;

            try
            {
                key = Registry.ClassesRoot.OpenSubKey("Outlook.Application\\CurVer", false);
                if (key != null)
                {
                    var version = key.GetValue("", "Outlook.Application.9").ToString();
                    key.Close();

                    var position = version.LastIndexOf(".");
                    if (position >= 0)
                    {
                        version = version.Remove(0, position + 1);
                        return Convert.ToInt32(version);
                    }
                }
            }
            catch
            {
                if (key != null)
                {
                    key.Close();
                }
            }

            return -1;
        }