0

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?

mspnr
  • 416
  • 4
  • 12

2 Answers2

1

You can use Graph for that. I don't think you'd be able to use VBA though.

https://learn.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-1.0&tabs=http

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Now we have two very similar answers to the question. I will ask my extra question here. Please answer it here or join the discussion [above](https://stackoverflow.com/a/70906637/10475643). Is Graph API available in Microsoft 365 only? I think some companies still use older version or on premise Exchange servers. In this case Graph API is very narrow solution. Also it looks like Outlook displays these lights just locally. If I change IM provider, the lamps look different. If Outlook can retrieve the data via COM interface, why it cannot be retrieved by any other program? – mspnr Jan 31 '22 at 16:53
  • Yes, Graph is M365 only. You can try to use the IM provider interfaces at your link above, but I don't know I have ever heard of anymore using them as a client, most people only create their own providers for Outlook's use. – Dmitry Streblechenko Jan 31 '22 at 18:01
1

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

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thank you for confirming, that the status is missing in the object model, I thought I overlooked it. Is Graph API available in Microsoft 365 only? I think some companies still use older version or on premise Exchange servers. In this case Graph API is very narrow solution. Also it looks like Outlook displays these lights just locally. If I switch IM provider, the lamps in Outlook look different. If Outlook can retrieve the data via COM interface, why it cannot be retrieved by any other program? – mspnr Jan 31 '22 at 16:49
  • Because Outlook doesn't expose it. – Eugene Astafiev Jan 31 '22 at 17:05
  • OK. Let's assume the final answer is: retrieving of online status in Outlook using VBA is not possible, because the status is not exposed in SDK. – mspnr Feb 01 '22 at 19:32