IUccContainerMembershipManager.GetCategoryInstancesForUri 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.

Gets the collection of category instances of a given category name and belonging to the containers of which the given user is a member.

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

Syntax

'Declaration
Function GetCategoryInstancesForUri ( _
    pUri As UccUri, _
    bstrCategoryName As String, _
    enBroaderScope As UCC_CONTAINER_MEMBERSHIP_SCOPE _
) As IUccCollection
IUccCollection GetCategoryInstancesForUri (
    UccUri pUri,
    string bstrCategoryName,
    UCC_CONTAINER_MEMBERSHIP_SCOPE enBroaderScope
)
IUccCollection^ GetCategoryInstancesForUri (
    UccUri^ pUri, 
    String^ bstrCategoryName, 
    UCC_CONTAINER_MEMBERSHIP_SCOPE enBroaderScope
)
IUccCollection GetCategoryInstancesForUri (
    UccUri pUri, 
    String bstrCategoryName, 
    UCC_CONTAINER_MEMBERSHIP_SCOPE enBroaderScope
)
function GetCategoryInstancesForUri (
    pUri : UccUri, 
    bstrCategoryName : String, 
    enBroaderScope : UCC_CONTAINER_MEMBERSHIP_SCOPE
) : IUccCollection

Parameters

  • pUri
    A value of the IUccUri* (UccUri, for a .NET application) type. This specifies the SIP URI of a user ("sip:joe@contoso.com") or a network domain ("sip:contoso.com"). This applies only if the specified container membership scope (below) is of the UCCCMS_USER type.
  • bstrCategoryName
    A value of the BSTR (string, for a .NET application) type. This specifies the category name for the category instances collection.

Return Value

A value of the IUccCollection** (IUccCollection, for a .NET application) type. Each element of the resultant collection is an IUccCategoryInstance object.

Remarks

This method searches all containers for a Uri that matches the passed Uri and passed scope. When a matching container is found, all category instances matching the passed category name are added to the IUccCollection returned to the calling code. The returned collection represents all category instances that a given Uri receives with a subscription to the local user's presentity.

Win32 COM/C++ Syntax

HRESULT GetCategoryInstancesForUri
(
   IUccUri* pUri,
   BSTR bstrCategoryName,
   UCC_CONTAINER_MEMBERSHIP_SCOPE enBroaderScope,
   IUccCollection** ppCategoryInstanceCollection
);

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 method accepts a string Uri, category context name, and membership scope to search. The category instance collection returned by the call to GetCategoryInstancesForUri is iterated over and the scope and returned category name/value pairs are displayed on a local user's system console.

public void FindURICategoryInstances(string URI, string Category, string Scope)
{
   UccUri u = ContactManager._UriManager.ParseUri(URI);
   IUccCollection cl = null;
   switch (Scope)
   {
      case "UCCCMS_USER":
         cl = this.cmm.GetCategoryInstancesForUri(
            u,
            Category,
            UCC_CONTAINER_MEMBERSHIP_SCOPE
            .UCCCMS_USER);
         break;
      case "UCCCMS_DOMAIN":
         string[] symbol = new string[] { "@" };
         string[] spitResult = URI.ToLower().Split(symbol, StringSplitOptions.None);
         u = ContactManager._UriManager.ParseUri(spitResult[1]);
         cl = this.cmm.GetCategoryInstancesForUri(
            u,
            Category,
            UCC_CONTAINER_MEMBERSHIP_SCOPE
            .UCCCMS_DOMAIN);
         break;
      case "UCCCMS_COMPANY":
         cl = this.cmm.GetCategoryInstancesForUri(
            u,
            Category,
            UCC_CONTAINER_MEMBERSHIP_SCOPE
            .UCCCMS_COMPANY);
         break;
      default:
         break;
   }
    if (cl != null && cl.Count > 0)
    {
        StringBuilder sb = new StringBuilder();
        foreach (IUccCategoryInstance ci in cl)
        {
            ciList.Add(ci.Value.ToString());
            sb.Append("Context: " + ci.CategoryContext.Name);
            sb.Append(" Instance Value: " + ci.Value);
        }
        Console.WriteLine("Categories " + sb.ToString());
    }
}

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

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