Share via


Using the Container Membership Manager

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.

Using the IUccContainerMembershipManager interface, you can discover the local user presence categories a subscriber sees. In addition, you can discover the subscriber's container membership based on the best ACE match. This feature is useful when you want to add a subscriber to a container and want to check membership in other containers first. Before adding the subscriber to the new container, you should check the subscriber's existing container membership.

FindContainerMember

The table represents the ACL container configuration for a local Unified Communications Client API client user. The local user has configured her ACL containers as follows:

  • Two subscribers in her "Team" container 300.
  • One subscriber and publicCloud users in her "Block" container.
  • A domain in her "company" container.
  • Other employees in her own company in the "company" container. The Unified Communications Client API enumeration is UCC_CONTAINER_MEMBERSHIP_SCOPE.UCCCMS_COMPANY.
  • Users of any Office Communications Server outside her company in container 100. The Unified Communications Client API enumeration is UCC_CONTAINER_MEMBERSHIP_SCOPE.UCCCMS_FEDERATED_PUBLIC.
Container/Member Scope Value

Container: Blocked

32000

Member:UCCCMS_USER

phalberg@proseware.com

Member:UCCCMS_EVERYONE

n/a

Container: Private

400

Container: Team

300

Member:UCCCMS_USER

dPark@contoso.com

Member:UCCCMS_USER

surajP@contoso.com

Container: Company

200

Member:UCCCMS_COMPANY

n/a

Member:UCCCMS_DOMAIN

tailspintoys.com

Container: federated

100

Member:UCCCMS_FEDERATED_ENTERPRISE

n/a

The C# examples uses this ACL configuration as a basis for membership searches.

Example 1

The user wants to find the container membership of phalberg@proseware.com. The ACE representing the search target has a scope of UCCMS_USER. The first argument of the method is the subscribers URI. The second argument is the scope of the first argument. In this case, "phalberg@proseware.com" is an individual user. You should always use this scope when the first argument contains a user URI.

The third argument is the matching method you want TryFindContainerMember to use. If you use UCCMMT_BEST, the method returns an exact match if one exists. If an exact match does not exist, the closest match is returned.

Using UCCMMT_EXACT only returns an IUccContainerMember if an exact match is found. Otherwise, a COM exception of NOT_EXIST is raised.

cm = this.cmm.FindContainerMember(
              "phalberg@proseware.com",
              UCC_CONTAINER_MEMBERSHIP_SCOPE
             .UCCCMS_USER,
              UCC_CONTAINER_MEMBER_MATCHING_TYPE
             .UCCCMMT_BEST);

In this case, the IUccContainerMember returned represents an exact match for the subscriber. The Uri property has the value of "phalberg@ proseware.com" and Scope of UCCCMS_USER because the container that represents the best match has a member of the user type with an URI that matches the subscriber. The Containers property holds container ID 32000.

Example 2

In this example, the user is searching for a subscriber in her company. If you review the table, you do not see "aHauser@contoso.com". Container 200 contains a member of the scope UCCCMS_COMPANY. The scope of the member includes "aHauser@contoso.com".

cm = this.cmm.FindContainerMember(
              "aHauser@contoso.com",
              UCC_CONTAINER_MEMBERSHIP_SCOPE
             .UCCCMS_USER,
              UCC_CONTAINER_MEMBER_MATCHING_TYPE
             .UCCCMMT_BEST);

In this case, the IUccContainerMember returned represents a match for the scope of the company. The Uri property has no value and Scope of UCCCMS_COMPANY because the container that represents the best match includes an ACE entry whose scope is UCCCMS_COMPANY. The best match available is an ACE member representing the company "aHauser@contoso.com" is an employee of. The Containers property container ID 200.

Example 3

In the last example, the user is searching for the container that holds the domain, "tailspintoys.com". Tailspin Toys is a subsidiary of Contoso and the employees of Tailspin Toys are in the same company but with its own domain.

cm = this.cmm.FindContainerMember(
              "tailspintoys.com",
              UCC_CONTAINER_MEMBERSHIP_SCOPE
             .UCCCMS_DOMAIN,
              UCC_CONTAINER_MEMBER_MATCHING_TYPE
             .UCCCMMT_BEST);

The IUccContainerMember returned represents a match for the scope of the domain. The Uri property has no value and Scope of UCCCMS_DOMAIN because the container that represents the best match includes an ACE entry whose scope is UCCCMS_DOMAIN. The best match available is an ACE member representing the domain "tailspin.com". The Containers property holds container ID 200.

GetCategoryInstancesForUri

To get a collection of the category instances that a subscriber receives to encapsulate a local user's presence, call GetCategoryInstancesForUri. The IUccCollection returned contains a set of IUccCategoryInstance objects from the container that holds the subscribers membership.

The following C# code snippet returns a collection of contactCard IUccCategoryInstance objects representing the contact card presence information published to the container to which "dPark@contoso.com" belongs.

The returned collection is iterated over and the value of each contact card instance is displayed on the system console window.

IUccCollection cl = this.cmm.GetCategoryInstancesForUri(
     "dPark@contoso.com",
     "contactCard",
     UCC_CONTAINER_MEMBERSHIP_SCOPE
    .UCCCMS_COMPANY);
if (cl != null && cl.Count > 0)
{
    foreach (IUccCategoryInstance ci in cl)
    {
        Console.WriteLine(ci.Value.ToString());
    }
}

See Also

Concepts

Granting Permissions to View Published Presence States