Share via


IUccSubscriber Interface

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.

Encapsulates subscription acknowledgement functionality for the category instances published by the local user.

Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)

Syntax

'Declaration
Public Interface IUccSubscriber
    Inherits IUnknown
public interface IUccSubscriber : IUnknown
public interface class IUccSubscriber : IUnknown
public interface IUccSubscriber extends IUnknown
public interface IUccSubscriber extends IUnknown

Remarks

This interface can be queried from an IUccCategoryInstance object of the "subscribers" category name. When a remote user adds the local user to a subscription as an IUccPresentity object, the local user receives a "subscribers" category instance provided that the local client has subscribed to the "subscribers" category instances as part of the self-subscription to various category context.

Win32 COM/C++ Syntax

interface IUccSubscriber : IUnknown

Example

The following example handles the OnCategoryInstanceAdded event that is raised when a client is provisioned with a subscriber object. The example uses the Acknowledged property to direct the client to display a standard Windows message dialog prompting the local user to add the subscribing user to a contact list. If the local user responds to the MessageBox dialog with either a Yes or a No, the handler sets the Acknowledged flag of the subscriber to True and publishes the subscriber object.

void _IUccCategoryContextEvents.OnCategoryInstanceAdded(
   IUccCategoryContext pCategoryCtx, 
   UccCategoryInstanceEvent pCategory)
{
   IUccCategoryInstance ci = pCategory.CategoryInstance;
   IUccCategoryContext catContext = pCategory.CategoryInstance.CategoryContext;
   switch (pCategory.CategoryInstance.CategoryContext.Name.ToLower().Trim())
   {
      case "contacts":
         break;
      case "groups":
         break;
      case "subscribers":
         IUccSubscriber subscribingUser = ci as IUccSubscriber;
         Boolean _acknowledged = false;
         if (subscribingUser.Acknowledged == false)
         {
            DialogResult r = MessageBox.Show(
               subscribingUser.Uri.AddressOfRecord +
               " at " +
               subscribingUser.SourceType.ToString() +
               " has added you as a contact. " +
               System.Environment.NewLine +
               "Do you want to add the user to your contact list?",
               "Subscription Acknowlegement",
               MessageBoxButtons.YesNo,
               MessageBoxIcon.Question,
               MessageBoxDefaultButton.Button1);
            switch (r)
            {
               case DialogResult.Yes:
                  // add remote user as contact
                  this.AddContact(subscribingUser.Uri.AddressOfRecord);
                  _acknowledged = true;
                  break;
               case DialogResult.No:
                  _acknowledged = true;
                  break;
            }
            if (_acknowledged == true)
            {
               IUccCategoryInstance subCI = ci.CreatePublishableCategoryInstance();
               IUccSubscriber sub = subCI as IUccSubscriber;
               sub.Acknowledged = true;
               subCI.PublicationOperation = UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD;
               PublishCategoryInstance(subCI, "subscribers");
            }
         }
         break;
      default:
         break;
   }
}

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2000 with Service Pack 4, Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

IUccSubscriber Members
Microsoft.Office.Interop.UccApi Namespace