Export (0) Print
Expand All

_IUccSessionParticipantCollectionEvents.OnParticipantAdded 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.

Raised when a new participant is added to the session.

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

void OnParticipantAdded (
	IUccSession pEventSource,
	UccSessionParticipantCollectionEvent pEventData
)
void OnParticipantAdded (
	IUccSession pEventSource, 
	UccSessionParticipantCollectionEvent pEventData
)
function OnParticipantAdded (
	pEventSource : IUccSession, 
	pEventData : UccSessionParticipantCollectionEvent
)

Parameters

pEventSource

A value of the IUccSession* (IUccSession, for a .NET application) type. This identifies the IUccSession instance in which the AddParticipant request is made.

pEventData

A value of the IUccSessionParticipantCollectionEvent* (UccSessionParticipantCollectionEvent, for a .NET application) type. This contains the information about the newly added participant. After receiving the participant object the application should proceed advising the newly added participant object of an implementation of the event handlers (as defined by _IUccSessionParticipantEvents) to ensure that participant-specific events will be received and handled.

The application implementing this event handler receives the participant object that has been added successfully to the source session. In a peer-to-peer session such as an instant messaging session with two participants, the initiating endpoint receives this event when the local user and remote user endpoint are added to the session. In transmission-free sessions such as a conference session, all session participants receive this event when a participant is added to the conference session.

A client should use this event to advise for events specific to the newly added particpant. Regardless of the session Type, a client should advise for _IUccSessionParticipantEvents. In an instant messaging session, the client should also advise for _IUccInstantMessagingSessionParticipantEvents. In a conference session, advise for _IUccConferenceSessionParticipantEvents. For audio/video sessions, advise for _IUccAudioVideoSessionParticipantEvents. An Application session requires events of the _IUccApplicationSessionParticipantEvents type. All of these session participant event types allow a local client to receive notification of remote session participant state and received messages.

The local client receives this event twice when the local user is added. One of the instances represents the local user endpoint and the other instance represents the local user as a session participant. The two instances are differentiated by the IsLocal propery of the IUccSessionParticipant instance received as event data.

Win32 COM/C++ Syntax

HRESULT OnParticipantAdded
(
   IUccSession* pEventSource,
   IUccSessionParticipantCollectionEvent* pEventData
);
Cc667914.note(en-us,office.12).gifNote:
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.

The following example is drawn from an application class that handles events for the session participant, application session participant, conference session participant, audio/video session participant, or instant messaging session participant. The example determines what type of session participant has been received and advises for the corresponding session participant event. Finally, the handler advises for generic session participant events for the received participant.

/// <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)
    {
        switch (pEventSource.Type)
            { 
                case UCC_SESSION_TYPE.UCCST_APPLICATION:
                    UCC_ Advise<_IUccApplicationSessionParticipantEvents>(
                        pEventData.Participant,
                        this);
                    break;
                case UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO:
                    UCC_ Advise<_IUccAudioVideoSessionParticipantEvents>(
                    vpEventData.Participant,
                        this);
                    break;
                case UCC_SESSION_TYPE.UCCST_CONFERENCE:
                    UCC_Advise<_IUccConferenceSessionParticipantEvents>(
                        pEventData.Participant,
                        this);
                    break;
                case UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING:
                    UCC_Advise<_IUccInstantMessagingSessionParticipantEvents>(
                        pEventData.Participant,
                        this);
                    break;
            }
            int pCookieValue = 0;
        UCC_Advise<_IUccSessionParticipantEvents>(
            p,
            this);
    }
}

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

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

Show:
© 2015 Microsoft