How to trigger presence change for a contact in IM client application?
I am making an IM client application for integrating presence in Outlook by following this article - https://learn.microsoft.com/en-us/office/client-developer/shared/integrating-im-applications-with-office#introduction
When Outlook starts, it calls the method BatchGetContactInformation
present in the IContact interface to get the presence for a contact and it is working fine for me. But for regularly monitoring a contact's presence, Outlook creates subscriptions for those contacts using the Subscribe
method in the IContactSubscription interface. In the docs, it is written
The IContactSubscription.Subscribe method allows an IM client application to access presence observers for the contact. It can use a polling strategy to get the presence from the server for the contacts for that the IM client application has subscribed to.
So, I am using a timer which runs at an interval of 5 seconds and calls the RaiseOnContactInformationChangedEvent
function for every contact in the list of subscribed contacts. Here is the implementation of the event:
public event _IContactEvents_OnContactInformationChangedEventHandler OnContactInformationChanged;
public void RaiseOnContactInformationChangedEvent(ContactInformationChangedEventData _eventData)
{
if(OnContactInformationChanged != null)
{
OnContactInformationChanged(this, _eventData);
}
}
I have implemented the ContactInformationChangedEventData
interface and made a class which is ComVisible. I have added ContactInformationType.ucPresenceAvailabilityin the ContactInformationType[]
of the eventData but Outlook is not calling the GetContactInformation
or BatchGetContactInformation
method for that contact. How can I make Outlook call those functions for a contact?