Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)
A subscription is a type with properties describing both what information a local user is interested in and who published the information of interest. The IUccSubscription interface exposes functionality that allows a user to add or remove the names of categories of interest as well as maintain a list of presentities (IUccPresentity) representing publishing users.
A local subscribing user can receive publication updates only for presentities added to a subscription. Further, the local user's subscription must specify which updated categories are refreshed in the client. Calling the Subscribe method on the IUccSubscription interface sends a subscription request to a Unified Communications server. A client application first creates a subscription, then adds category names and presentites of interest, and finally requests the subscription. Publication updates are returned asynchronously in the form of _IUccCategoryContextEvents events.
The following example creates a subscription object, provides a presentity and a list of interested categories. As each interface reference is retrieved through a cast operation, the client advises for interface events. Finally the example creates the subscribe request to an Unified Communications server.
IUccSubscriptionManager subMgr = endpoint as IUccSubscriptionManager; // Subscribe for "categories" and "containers" by creating a new subscription, // advise for subscription events, adding self presentity and category names // to the subscription and calling subscribe IUccSubscription selfSubscription = subMgr.CreateSubscription(null); // Create a presentity to represent self and advise for events UccUri u = _UriManager.ParseUri(this.selfURI); this.selfPresentity = this.selfSubscription.CreatePresentity(u, null); //Advise IUccPresentity object of "this" as event handler for raised //presentity events UCC_Advise<_IUccPresentityEvents>(this.selfPresentity, this); //Advise IUccSubscription object of "this" as event handler for raised //subscription events UCC_Advise<_IUccSubscriptionEvents>(this.selfSubscription, this); //add interested publishing user ("self" in this case) to subscription selfSubscription.AddPresentity(this.selfPresentity); //add interested categories selfSubscription.AddCategoryName("categories"); selfSubscription.AddCategoryName("containers"); selfSubscription.AddCategoryName("contacts"); selfSubscription.AddCategoryName("groups"); selfSubscription.AddCategoryName("subscribers"); //make subscription request to server selfSubscription.Subscribe(null);