This documentation is archived and is not being maintained.

Receive List of Remote Subscribers

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The local client can access a list of all the remote users who have subscribed to the presence of the local user. To receive this list, the client application must subscribe to the "subscribers" category. The IUccCategoryInstance returned must be cast to IUccSubscriber to obtain necessary subscriber information. IUccSubscriber contains a UccUri instance, an acknowledgement flag, and the source network of the subscribing user. Using the UccUri instance of a subscriber from this list, the local user can restrict or expand the remote users access to the local user's published presence. In addition, the subscribing user can be added to the local user's contact list.

To receive subscription notifications, the local application must add the "subscribers" category to the self-subscription object. For information about self-subscription, see Subscribe to Category Instances.

A local user must handle the OnCategoryInstanceAdded event for this category.

Adding the subscriber to a local user's contact list can be handled by the same callback function. For information about adding the subscriber to the local contact list, see Add a Contact to the Contact List. The callback function can be used to create an exception to the access rules setup in the user's published ACL containers for the subscriber. For example, if the subscribing user belongs to a domain that has access to published category data at the organizational level, the local user might want to restrict the access of the subscriber. This is done by adding the subscriber to an existing ACL container representing the desired access level. As custom ACL containers are allowed by Unified Communications Server, the local application can create a new container, add the subscriber and a set of published categories, and publish the custom container. For more information, see Manage ACL Container Membership. The following example is a partial callback method that handles the subscribers category instance.

void _IUccCategoryContextEvents.OnCategoryInstanceAdded(
    IUccCategoryContext pCategoryCtx, 
    UccCategoryInstanceEvent pCategory)
    StringComparer strComparer = StringComparer.Create(System.Globalization.CultureInfo.CurrentCulture, true);
    IUccCategoryInstance ci = pCategory.CategoryInstance;
    switch (pCategoryCtx.Name.ToLower().Trim())
        case "contacts":
        case "groups":
        case "subscribers":
            IUccSubscriber subscriber = ci as IUccSubscriber;
            // acknowledge subscriber
            // add subscriber to local contact list
            // assign ACL container membership
        case "containers":

The callback method in the previous example is a good place to acknowledge the subscribing user. The subscription to the local user's presence cannot be rejected. Failing to handle this event has no effect on the remote user's subscription.

The C# sample uses the following programming pattern:

  1. Cast the generic IUccCategoryInstance interface to the IUccSubscriber interface.
  2. Read the Acknowledged property to determine whether this subscriber needs to be acknowledged.
  3. Create a publishable category instance of the subscriber by calling into CreatePublishableCategoryInstance.
    The acknowledged property can only be set on a publishable subscriber interface. Attempting to set the property on the original subscriber interface results in a COM exception.
  4. Create a publication object.
  5. Advise for publication events.
  6. Add the new publishable IUccCategoryInstance to the publication.
  7. Publish the category.
// publish acknowlegement
    if (subscribingUser.Acknowledged == false)
       IUccCategoryInstance subCI = ci.CreatePublishableCategoryInstance();
       IUccSubscriber sub = subCI as IUccSubscriber;
       sub.Acknowledged = true;
       IUccPublication pub = (IUccPublication)pubMgr.CreatePublication();
       if (pub != null)
          UCC_Advise<_IUccPublicationEvent>(pub, this);