Share via


IUccContainer.AddMember 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.

Adds a container member to this container.

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

Syntax

'Declaration
Sub AddMember ( _
    pMember As IUccContainerMember _
)
void AddMember (
    IUccContainerMember pMember
)
void AddMember (
    IUccContainerMember^ pMember
)
void AddMember (
    IUccContainerMember pMember
)
function AddMember (
    pMember : IUccContainerMember
)

Parameters

  • pMember
    A value of the IUccContainerMember* (IUccContainerMember, for a .NET application) type. This specifies the to-be-added container member.

Remarks

Adding a container member allows the users specified by the container member to access the category instances contained in this container.

Win32 COM/C++ Syntax

HRESULT AddMember
(
   IUccContainerMember* pMember
);

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 is a method from a client application class that wraps an IUccContainer instance (this._container). The method accepts an IUccPublicationManager instance, string, and the container membership scope. The method uses the Members property to return a collection of existing container members. If none of the existing members match the scope and Uri desired, a new IUccContainerMember instance is created by the passed publication manager instance. Finally, the new instance is added to the container and a Boolean true value is returned by the method.

public Boolean AddNewMember(
   IUccPublicationManager pPm, 
   string pUri, 
   UCC_CONTAINER_MEMBERSHIP_SCOPE pScope)
{
   Boolean returnValue = false;
   if (pPm != null && pUri != null && pScope.ToString().Length > 0)
   {
      IUccContainerMember member = null;
      IUccCollection members = this._container.GetMembersWithScope(pScope);
      if (members.Count > 0)
      {
         Boolean foundMember = false;
         foreach (IUccContainerMember m in members)
         {
            if (m.Uri.ToLower() == pUri.ToLower())
            {
               foundMember = true;
               break;
            }
         }
         if (foundMember == false)
         {
            member = pPm.CreateContainerMember(pUri, pScope);

            // New member is added to the container
            this._container.AddMember(m);
            returnValue = true;
         }
      }
      else
      {
         member = pPm.CreateContainerMember(pUri, pScope);

            // New member is added to the container
         this._container.AddMember(m);
         returnValue = true;
      }
   }
   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

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