IUccCategoryInstance 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 a category instance of the generic type.

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

Syntax

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

Remarks

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

Example

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.

Note

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;
   }
}

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

IUccCategoryInstance Members
Microsoft.Office.Interop.UccApi Namespace