IUccSession.Type Property

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.

Gets the session type.

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

Syntax

'Declaration
ReadOnly Property Type As UCC_SESSION_TYPE
UCC_SESSION_TYPE Type { get; }
property UCC_SESSION_TYPE Type {
    UCC_SESSION_TYPE get ();
}
/** @property */
UCC_SESSION_TYPE get_Type ()
function get Type () : UCC_SESSION_TYPE

Property Value

A value of the UCC_SESSION_TYPE* (UCC_SESSION_TYPE, for a .NET application) type.

Remarks

Win32 COM/C++ Syntax

HRESULT get_Type
(
   UCC_SESSION_TYPE* penType
);

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 uses the Type property of a session instance to determine what type of session invitation the client has received through the session manager event OnIncomingSession. The type value obtained allows the client to provide the user with the session type in the invitation as well as the appropriate IUccSession derived interface to cast the incoming session to. Note the use of the UCC_SESSION_TYPE enumeration within the switch statement.

/// <summary>
/// handles session invitations by displaying a dialog for
/// local user advising user of invitation and providing a mechanism
/// for the user to respond to the invitation
/// </summary>
/// <param name="pEventSource"></param>
/// <param name="pEventData"></param>
void _IUccSessionManagerEvents.OnIncomingSession(
    IUccEndpoint pEventSource,
    UccIncomingSessionEvent pEventData)
{

    System.Windows.Forms.DialogResult result;
    switch (pEventData.Session.Type)
    {
        case UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING:
            //Ask the user for permission to accept or decline the
            // pending invitation.
            result = System.Windows.Forms.MessageBox.Show(
                 "Accept incoming IM session from " + pEventData.Inviter.Uri.UserAtHost + "?",
                 "Incoming Session",
                 System.Windows.Forms.MessageBoxButtons.YesNo);

            if (result != System.Windows.Forms.DialogResult.Yes)
            {
                // The user has rejected the invitation.
                pEventData.Reject(
                   UCC_REJECT_OR_TERMINATE_REASON.UCCROTR_UNAVAILABLE);
                return;
            }
            IUccInstantMessagingSession imSession = pEventData.Session as IUccInstantMessagingSession;
            pEventData.Accept();
            UCC_Advise<_IUccSessionEvents>(pEventData.session, this);
            break;
        case UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO:
            result = System.Windows.Forms.MessageBox.Show(
                 "Accept incoming AV session from " + pEventData.Inviter.Uri.UserAtHost + "?",
                 "Incoming Session",
                 System.Windows.Forms.MessageBoxButtons.YesNo);

            if (result != System.Windows.Forms.DialogResult.Yes)
            {
                // The user has rejected the invitation.
                pEventData.Reject(
                   UCC_REJECT_OR_TERMINATE_REASON.UCCROTR_UNAVAILABLE);
                return;
            }
            IUccInstantMessagingSession imSession = pEventData.Session as IUccInstantMessagingSession;
            pEventData.Accept();
            UCC_Advise<_IUccSessionEvents>(pEventData.session, this);
            break;
        default:
            break;
    }
}

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

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

Other Resources

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