vbaoutlookuser-presence

How to retrieve online presence status in Outlook using VBA


Problem

I need to get online presence status from Microsoft Outlook using VBA. The status is presented as a green-yellow-red-grey light displayed near the contact name and usually provided by some instant message(IM) application (e.g. Teams, Skype, Zoom, Jabber etc.).

Here is how it is usually look:

example

Available data

Unfortunately the status is not available in Outlook structures AddressEntry or ExchangeUser, which are pretty easy to acquire.

Note: Please do not confuse online presence with calendar availability, which can easily retrieved using function GetFreeBusy.

Alternative view

The only relevant and pretty decent description related to the topic I found here: https://learn.microsoft.com/en-us/office/client-developer/shared/integrating-im-applications-with-office .

But here the topic is presented from the different angle - what should be done from the IM application side to provide this status. In short: the IM app should add some data to the registry under ...\Software\IM Providers\... and implement interface IUCOfficeIntegration, so Outlook can use it to retrieve the status.

So an intermediate idea was to retrieve the status via this interface from the IM app directly. But there is very few information about calling COM interfaces from VBA.


Does anyone can provide any hints how the status can be retrieved?


Solution

  • The Outlook object model doesn't provide any property or method for that. Graph API provides the Get presence methods for that.