Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IUccCategoryInstance Interface

Encapsulates a category instance of the generic type.

Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)
public interface IUccCategoryInstance : IUnknown
public interface IUccCategoryInstance extends IUnknown
public interface IUccCategoryInstance extends IUnknown

This is the base interface any strongly typed category instance is derived from. For example, a contact list item received as an IUccCategoryInstance is cast to the IUccContact interface to expose properties unique to a contact. The appropriate casting operation depends upon the category context to which the instance belongs.

An application can define its own generic category context and instance. In this case, the IUccCategoryInstance is not cast to an implementing interface. The interface defines the data type of a generic category instance. The value of a generic category instance is an XML string. The server is agnostic of the XML schemas used to describe the value but requires that it be well-formed. The client is responsible for parsing the XML value of such a category instance. A generic category instance can be used for a custom category instance.

Win32 COM/C++ Syntax

interface IUccCategoryInstance : IUnknown

This is an abbreviated example of an event handler for the OnCategoryInstanceAdded event. The example casts the base IUccCategoryInstance interface to the appropriate implementing interface. In this case, the interface is cast to the UccContactt or IUccGroup depending on the value of the category context Name property.

Cc702691.note(en-us,office.12).gifNote:
Regardless of what implementing interface IUccCategoryInstance is cast to, an application must advise for events raised by the base interface to receive category instance events.
void _IUccCategoryContextEvents.OnCategoryInstanceAdded(
   IUccCategoryContext pCategoryCtx, 
   UccCategoryInstanceEvent pCategory)
{
   IUccCategoryInstance ci = pCategory.CategoryInstance;
   switch (pCategory.CategoryInstance.CategoryContext.Name.ToLower())
   {
      case "contacts":
         UCC_Advise<_IUccCategoryInstanceEvents>(
            pCategory.CategoryInstance, 
            this);
         //cast category instance to contact and advise for 
         //contact events
         UccContact addedContact = pCategory.CategoryInstance as UccContact;
         UCC_Advise<_IUccContactEvents>(
            addedContact, 
            this);
         Break;
      case "groups":
         int Gcookie = 0;
         UCC_Advise<_IUccCategoryInstanceEvents>(
            pCategory.CategoryInstance, 
            this);
         //cast category instance to group interface and advise
         //for group events
         IUccGroup addedGroup = pCategory.CategoryInstance as IUccGroup;
         int gGcookie = 0;
         UCC_Advise<_IUccGroupEvents>(
            addedGroup, 
            this);
         break;
   }
}

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.