IUccSessionParticipant Interface

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.

Encapsulates a participant member of a session.

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

Syntax

'Declaration
Public Interface IUccSessionParticipant
    Inherits IUnknown
public interface IUccSessionParticipant : IUnknown
public interface class IUccSessionParticipant : IUnknown
public interface IUccSessionParticipant extends IUnknown
public interface IUccSessionParticipant extends IUnknown

Remarks

Win32 COM/C++ Syntax

interface IUccSessionParticipant : IUnknown

Example

Creating an instance of IUccSessionParticipant

A local endpoint obtains a new instance of IUccSessionParticipant by calling CreateParticipant on a non-terminated IUccSession instance.

/// <summary>
/// Creates a new session participant with associated
/// context metadata
/// </summary>
/// <param name="pSession">Session to create user in</param>
/// <param name="user">UccUri of remote user to add to session</param>
/// <param name="pContextKey">string property name of additional context property</param>
/// <param name="pContextValue">string value of additional context</param>
/// <param name="pEventSink">class instance to handle session participant events</param>
/// <returns>new session participant</returns>
public IUccSessionParticipant CreateSessionParticipant(
    IUccSession pSession,
    UccUri user,
    string pContextKey,
    string pContextValue,
    _IUccSessionParticipantEvents pEventSink)
{
    IUccSessionParticipant returnValue = null;
    if (pSession == null)
    {
        throw new ArgumentNullException(
            "pSession",
            "session cannot be null");
    }
    if (user == null)
    {
        throw new ArgumentNullException(
            "user", 
            "user cannot be null");
    }
    if (pEventSink == null)
    {
        throw new ArgumentNullException(
            "pEventSink",
            "event sink cannot be null");
    }
    try
    {
        //create a session participant using the passed SIP uri
        UccContext userContext = new UccContext();
        userContext.AddNamedProperty("User", user.User);
        if (pContextKey.Length > 0 && pContextValue.Length > 0)
        {
            userContext.AddNamedProperty(pContextKey, pContextValue);
        }
        returnValue = pSession.CreateParticipant(
            user,
            userContext);
        UCC_Advise<_IUccSessionParticipantEvents>(
            returnValue, 
            pEventSink);
    }
    catch (COMException)
    { }
    return returnValue;

}

Obtaining an Session Participant from an Event

A client receives instances of IUccSessionParticipant when the local endpoint is a partipant in a session. Every session participant including the local endpoint itself is provisioned on the client through the OnParticipantAdded event.

/// <summary>
/// called when a participant is added to current session.
/// advises for both session participant events and more specific
/// session type participant events. 
/// </summary>
/// <param name="pEventSource">session instance where participant is added</param>
/// <param name="pEventData">the newly added session participant</param>
void _IUccSessionParticipantCollectionEvents.OnParticipantAdded(
    IUccSession pEventSource, 
    UccSessionParticipantCollectionEvent pEventData)
{
    IUccSessionParticipant p = pEventData.Participant;
    if (p.IsLocal == false)
    {
        //add new participant to UI list
        //advise for IuccSessionParticipantEvents
        //advise for session type specific participant events
    }
}

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 Members
Microsoft.Office.Interop.UccApi Namespace

Other Resources

Code Listing: Basic Event Registration and Other Helper Methods in C#