Presence Scenarios: Query and Subscription
To obtain the category instances published by a given presentity, you query or subscribe to category instances. A query returns a "snapshot" of the publishing presentities category instances. A subscription returns both the current "snapshot" of category instances and any further changes a publishing presentity makes to the category instance. A subscription dialog continues until explicitly ended by the subscribing user.
It is important that your application self-subscribes for the purposes of in-band provisioning. In-band provisioning is the process of provisioning a Unified Communications client and it requires a client to subscribe to the local user's published presence categories. An advantage of in-band provisioning is that a user can sign in to Office Communications Server from any device where the application is installed. The provisioned user presence categories are tied to the identity of the signed-in user rather than a device.
Subscribing to your own instances is accomplished by creating a new subscription, adding yourself as the presentity, and then adding the following categories to subscribe to: categories, containers, contacts, groups, and subscribers.
Custom applications can handle events for when category instances are added, modified, or removed. The category instance can be found from the event arguments passed into the event.
An example of a custom application that subscribes to presence data is a business process application that tracks sales accounts. Each account has a person associated with it who is responsible for managing the account. The custom application displays the status of each sales account and subscribes to the presence of each sales account manager. A user who is working with the custom application might have questions about a particular sales account, and the custom application could display the availability of the person in charge of the sales account so that the user can easily establish contact.