Retrieve version of Outlook

Add-in Express™ Support Service
That's what is more important than anything else

Retrieve version of Outlook
How to retrieve version of Outlook addin is installed into? 
Chris Stone




Posts: 15
Joined: 2009-04-08
How can I programatically determine the version of Outlook that's running? I saw here in some examples using Self.HostMajorVersion in the TAddinModule object, but that's not a valid property - compile errors. I have HostVersion, but that is showing 9.0.0.0 in both Outlook 2010 and Outlook 2003.

I am using Add-In Express 2009 with Delphi 6 Pro.


Thanks

Regards,

Chris Stone, MCSE
AxisInternet, Inc.
Posted 05 May, 2011 16:03:06 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Chris,

The HostMajorVersion property was introduced in Add-in Express 2010 (version 6.1). Please try to use the OutlookApp.Version property instead.
Posted 06 May, 2011 05:09:42 Top
Chris Stone




Posts: 15
Joined: 2009-04-08
Dmitry,

Thanks - that was just what I was looking for.

What does the TAddInModule.HostVersion property then refer to that would indicate 9.0.0.0 in both Outlook 2010 and 2003?


Regards,

Chris Stone, MCSE
AxisInternet, Inc.
Posted 06 May, 2011 10:27:36 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Chris,

The TadxCOMAddInModule.HostVersion property returns the value of the host application Version property and returns '9.0.0.0' string in case of an exception:


function TadxCOMAddInModule.GetHostVersion: WideString;
begin
  Result := '';
  try
    case FHostType of
      // ... 
      ohaOutlook: Result := FOutlook.Version;
      // ... 
    end;
  except
    Result := '9.0.0.0';
  end;
end;


In which event handler do you access this property?
Posted 06 May, 2011 10:51:18 Top
Chris Stone




Posts: 15
Joined: 2009-04-08
Dmitry,

In the OnCre ate event:

procedure TAddInModule.adxCOMAddInModuleCreate(Sender: TObject);
begin
ShowMessage('Outlook version ' + Self.HostVersion);
end;




Chris
Posted 06 May, 2011 11:06:33 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Chris,

The OnCreate event is raised right after your module is created, all public properties are initialized later. Please use the OnAddInInitialize event instead.
Posted 06 May, 2011 11:16:53 Top
Chris Stone




Posts: 15
Joined: 2009-04-08
Dmitry,

OK -thanks.


Chris
Posted 06 May, 2011 11:21:49 Top