Share via


IMAPISession::Logoff

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Ends a MAPI session.

HRESULT Logoff(
  ULONG_PTR ulUIParam,
  ULONG ulFlags,
  ULONG ulReserved
);

Parameters

  • ulUIParam
    [in] A handle to the parent window of any dialog boxes or windows to be displayed. This parameter is ignored if the MAPI_LOGOFF_UI flag is not set.

  • ulFlags
    [in] A bitmask of flags that control the logoff operation. The following flags can be set:

    • MAPI_LOGOFF_SHARED
      If this session is shared, all clients that logged on by using the shared session should be notified of the logoff in progress. The clients should log off. Any client that is using the shared session can set this flag. MAPI_LOGOFF_SHARED is ignored if the current session is not shared.

    • MAPI_LOGOFF_UI
      Logoff can display a dialog box during the operation, possibly prompting the user for confirmation.

  • ulReserved
    [in] Reserved; must be zero.

Return Value

  • S_OK
    The logoff operation was successful.

Remarks

The IMAPISession::Logoff method ends a MAPI session. When Logoff returns, none of the methods except for IUnknown::Release can be called.

Notes to Callers

When Logoff returns, release the session object by calling its IUnknown::Release method.

For more information about ending a session, see Ending a MAPI Session.

MFCMAPI Reference

For MFCMAPI sample code, see the following table.

File

Function

Comment

MAPIObjects.cpp

CMapiObjects::Logoff

MFCMAPI uses the IMAPISession::Logoff method to log off from the session before releasing it.

Note

Due to the fast shutdown behavior introduced in Microsoft Office Outlook 2007 Service Pack 2 or Microsoft Outlook 2010, clients should never pass the MAPI_LOGOFF_SHARED parameter to IMAPISession::Logoff. Passing MAPI_LOGOFF_SHARED will cause all MAPI clients to begin shutdown and unexpected behavior will occur.

See Also

Reference

IMAPISession : IUnknown

Concepts

MFCMAPI as a Code Sample

Ending a MAPI Session