Share via


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

Creates a new instance of a participant endpoint.

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

Syntax

'Declaration
Function CreateParticipantEndpoint ( _
    pUri As UccUri, _
    bstrEndpointId As String, _
    pContext As UccContext _
) As IUccSessionParticipantEndpoint
IUccSessionParticipantEndpoint CreateParticipantEndpoint (
    UccUri pUri,
    string bstrEndpointId,
    UccContext pContext
)
IUccSessionParticipantEndpoint^ CreateParticipantEndpoint (
    UccUri^ pUri, 
    String^ bstrEndpointId, 
    UccContext^ pContext
)
IUccSessionParticipantEndpoint CreateParticipantEndpoint (
    UccUri pUri, 
    String bstrEndpointId, 
    UccContext pContext
)
function CreateParticipantEndpoint (
    pUri : UccUri, 
    bstrEndpointId : String, 
    pContext : UccContext
) : IUccSessionParticipantEndpoint

Parameters

  • pUri
    A value of the IUccUri* (UccUri, for a .NET application) type. This specifies the SIP URI of the participant endpoint.
  • bstrEndpointId
    A value of the BSTR (string, for a .NET application) type. This specifies the ID for the participant endpoint.
  • 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 created 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 CreateParticipantEndpoint
(
   IUccUri* pUri,
   BSTR bstrEndpointId,
   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 returns a new session participant endpoint which can be later added to a session participant's endpoint collection. The example method requires an instance of UccUri representing the new endpoint. Optionally, an endpoint Id can be assigned. Although the example does not require it, a named property key and value can be passed. It is a good idea to do this as application specific metadata about a session participant endpoint can be usefull when a session participant has more than one endpoint.

/// <summary>
/// Creates a new session participant endpoint for the 
/// passed participant
/// </summary>
/// <param name="participant">session participant endpoint factory</param>
/// <param name="pUri">UccUri representing new endpoint</param>
/// <param name="endpointId">optional endpoint Id</param>
/// <param name="pContextKey">optional endpoint metadata context property name</param>
/// <param name="pContextValue">optional endpoint metadata context property value</param>
/// <returns>new session participant endpoint</returns>
private IUccSessionParticipantEndpoint MakeNewEndpoint(
    IUccSessionParticipant participant, 
    UccUri pUri, 
    int endpointId,
    string pContextKey,
    string pContextValue)
{
    IUccSessionParticipantEndpoint returnValue = null;
    if (participant == null)
    {
        throw new ArgumentNullException("participant", "session participant cannot be null");
    }
    if (pUri.AddressOfRecord.Length == 0)
    {
        throw new ArgumentException("Participant Uri must be valid");
    }
    try
    {
        UccContext endpointContext = new UccContextClass();
        if (pContextKey.Length > 0 && pContextValue.Length > 0)
        {
            endpointContext.AddNamedProperty(pContextKey, pContextValue);
        }

        returnValue = participant.CreateParticipantEndpoint(pUri, endpointId.ToString(), endpointContext);
    }
    catch (COMException e)
    {
        throw e;
    }
    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