Share via


IUccSessionParticipant.CopyParticipantEndpoint 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.

Copies an instance of a participant endpoint.

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

Syntax

'Declaration
Function CopyParticipantEndpoint ( _
    pInputParticipantEndpoint As IUccSessionParticipantEndpoint, _
    pContext As UccContext _
) As IUccSessionParticipantEndpoint
IUccSessionParticipantEndpoint CopyParticipantEndpoint (
    IUccSessionParticipantEndpoint pInputParticipantEndpoint,
    UccContext pContext
)
IUccSessionParticipantEndpoint^ CopyParticipantEndpoint (
    IUccSessionParticipantEndpoint^ pInputParticipantEndpoint, 
    UccContext^ pContext
)
IUccSessionParticipantEndpoint CopyParticipantEndpoint (
    IUccSessionParticipantEndpoint pInputParticipantEndpoint, 
    UccContext pContext
)
function CopyParticipantEndpoint (
    pInputParticipantEndpoint : IUccSessionParticipantEndpoint, 
    pContext : UccContext
) : IUccSessionParticipantEndpoint

Parameters

  • pInputParticipantEndpoint
    A value of the IUccSessionParticipantEndpoint* (IUccSessionParticipantEndpoint, for a .NET application) type. This specifies the participant endpoint from which a new copy is made.
  • pContext
    A value of the IUccContext* (UccContext, for a .NET application) type. This specifies the context associated with the resultant participant endpoint.

Return Value

A value of the IUccSessionParticipantEndpoint** (IUccSessionParticipantEndpoint, for a .NET application) type. This output parameter returns the newly copied participant endpoint if the method call succeeds or NULL if the operation fails.

Remarks

The application can set properties on the resultant participant endpoint and then add the endpoint to the participant.

Win32 COM/C++ Syntax

HRESULT CopyParticipantEndpoint
(
   IUccSessionParticipantEndpoint* pInputParticipantEndpoint,
   IUccContext* pContext,
   IUccSessionParticipantEndpoint** ppParticipantEndpoint
);

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 accepts an instance of IUccSessionParticipant as the source of a session participant endpoint collection to search and copy. The endpointUri parameter provides a match criteria for finding the endpoint in the collection that is the source of the copy. Optionally, calling code can specifiy context metadata to be added to the instance of IUccSessionParticipantEndpoint to be returned.

/// <summary>
/// returns a copy of the session participant endpoint that 
/// matches the passed Uri Address Of Record. If a context key and value
/// are provided, the a named property is added to the endpoint context
/// of the endpoint copy
/// </summary>
/// <param name="participant">session participant whose endpoint collection is source of copy</param>
/// <param name="endpointUri">Uri address of record to match</param>
/// <param name="pContextKey">optional metadata context named property name</param>
/// <param name="pContextValue">optional metadata context property value</param>
/// <returns></returns>
private IUccSessionParticipantEndpoint GetEndpointCopy(
    IUccSessionParticipant participant, 
    string endpointUri,
    string pContextKey,
    string pContextValue)
{
    IUccSessionParticipantEndpoint returnValue = null;
    if (participant == null)
    {
        throw new ArgumentNullException("participant", "Participant cannot be null");
    }
    if (endpointUri.Length == 0)
    {
        throw new ArgumentException("endpointUri", "Endpoint Uri string cannot be blank");
    }
    if (endpointUri.ToUpper().Substring(0,4)!= "SIP:")
    {
        endpointUri = "SIP:" + endpointUri.Trim();
    }
    UccContext endpointCtx = new UccContextClass();
    if (pContextKey.Length > 0 && pContextValue.Length > 0)
    {
        endpointCtx.AddNamedProperty(pContextKey,pContextValue);
    }
    foreach (IUccSessionParticipantEndpoint endpoint in participant.Endpoints)
    {
        if (endpoint.Uri.AddressOfRecord == endpointUri)
        {
            //if endpoint found, copy endpoint and return copy
            returnValue = participant.CopyParticipantEndpoint(
                endpoint, 
                endpointCtx);
            break;
        }
    }
    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

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