IUccPresentity.TryFindCategoryContext 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.

Attempts to find a category context of a given category name.

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

Syntax

'Declaration
Function TryFindCategoryContext ( _
    bstrCategoryName As String, _
    <OutAttribute> ByRef ppContext As IUccCategoryContext _
) As Boolean
bool TryFindCategoryContext (
    string bstrCategoryName,
    out IUccCategoryContext ppContext
)
bool TryFindCategoryContext (
    String^ bstrCategoryName, 
    [OutAttribute] IUccCategoryContext^% ppContext
)
boolean TryFindCategoryContext (
    String bstrCategoryName, 
    /** @attribute OutAttribute() */ /** @ref */ IUccCategoryContext ppContext
)

Parameters

  • bstrCategoryName
    A value of the BSTR (string, for a .NET application) type. This specifies the category name of interest.
  • ppContext
    A value of the IUccCategoryContext** (IUccCategoryContext, for a .NET application) type. This returns the found category context if it exists. This returns NULL if the category context does not exist.

Return Value

A value of the VARIANT_BOOL* (bool, for a .NET application) type. This returns TRUE if the specified category context can be found and FALSE if not.

Remarks

This method can be used to return a given category context from the collection of category context published by the presentity. The method returns a Booleantrue and the IUccCategoryContext out parameter is filled with the category context of interest.

Win32 COM/C++ Syntax

HRESULT TryFindCategoryContext
(
   BSTR bstrCategoryName,
   IUccCategoryContext** ppContext,
   VARIANT_BOOL* pbFound
);

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 returns the name of a given category if that category has been published by the IUccPresentity instance (this.Presentity) wrapped by the application class exposing the example method. Note that the call to TryFindCategoryContext returns the published category itself to calling code in an out parameter. This example method uses this feature to get the category name and return it as a string to calling code.

public string GetPublishedCategoryContext(string pCategoryName)
{
   string returnValue = string.Empty;
   if (pCategoryName == null)
   {
      throw new ArgumentNullException();
   }
   IUccCategoryContext foundContext;
   if (this.Presentity.TryFindCategoryContext(pCategoryName, out foundContext))
   {
      returnValue = foundContext.Name;
   }
   return returnValue;
}

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

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