_IUccPresentityEvents.OnCategoryContextAdded Method

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.

Raised when a category context is added to the specified presentity object.

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

Syntax

'Declaration
Sub OnCategoryContextAdded ( _
    pPresentity As UccPresentity, _
    pCategoryCtxtEvent As UccCategoryContextEvent _
)
void OnCategoryContextAdded (
    UccPresentity pPresentity,
    UccCategoryContextEvent pCategoryCtxtEvent
)
void OnCategoryContextAdded (
    UccPresentity^ pPresentity, 
    UccCategoryContextEvent^ pCategoryCtxtEvent
)
void OnCategoryContextAdded (
    UccPresentity pPresentity, 
    UccCategoryContextEvent pCategoryCtxtEvent
)
function OnCategoryContextAdded (
    pPresentity : UccPresentity, 
    pCategoryCtxtEvent : UccCategoryContextEvent
)

Parameters

  • pPresentity
    A value of the IUccPresentity* (UccPresentity, for a .NET application) type. This represents the publisher of the newly added category context.

Remarks

This event is the first in a chain of events by which an application gets to receive newly subscribed category instances and their ongoing updates. To continue the event chain the application must also advise the newly added IUccCategoryContext instance to receive those events defined in _IUccCategoryContextEvents.

Win32 COM/C++ Syntax

HRESULT OnCategoryContextAdded
(
   IUccPresentity* pPresentity,
   IUccCategoryContextEvent* pCategoryCtxtEvent
);

Note

In a Win32 application, the return value of a method or property is always an HRESULT value indicating the status of the call to the interface member. Any result of the operation is returned as a parameter marked with the [out, retval] attribute. In contrast, in a .NET application the HRESULT value indicating an error condition is returned as a COM exception and the [out, retval] parameter becomes the return value. For the UCC API-defined HRESULT values, see Trace and Handle Errors in Unified Communications Client API .

Example

The following example handles the OnCategoryContextAdded event raised when a given presentity has published a category context. The example displays the source network of the publishing user on the local user's system console. To do this, the client application reads the SourceType property of the publishing presentity. In this example, the client is interested in the "contactCard", "state", "note", and "freeBusy" categories published by a remote user. When one of these categories is added, the local client advises for category context events on the received context.

void _IUccPresentityEvents.OnCategoryContextAdded(
    UccPresentity pEventSource,
    UccCategoryContextEvent pCategoryCtxt)
{

    String contextName = pCategoryCtxt.CategoryContext.Name.ToLower();
    if (contextName == "contactcard" ||
      contextName == "state" ||
      contextName == "note" ||
      contextName == "freebusy")
    {
        //Advise for category context events to get notified when
        //corresponding instances are published
        UCC_Advise<_IUccCategoryContextEvents>(
        pCategoryCtxt.CategoryContext, 
        this);
    }
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

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

_IUccPresentityEvents Interface
_IUccPresentityEvents Members
Microsoft.Office.Interop.UccApi Namespace

Other Resources

Code Listing: Basic Event Registration and Other Helper Methods in C#