Send Feedback

The Advise method registers to receive notification of specified events affecting the session.


HRESULT Advise (
  ULONG cbEntryID,
  ULONG ulEventMask,
  ULONG FAR * lpulConnection


  • cbEntryID
    [in] Must be 0.
  • lpEntryID
    [in] Must be NULL.
  • ulEventMask
    [in] A mask of values indicating the types of notification events that the client is interested in and should be included in the registration. See Remarks for valid flags that can be combined for this parameter.
  • lpAdviseSink
    [in] Reference to an advise sink object, implemented on IMAPIAdviseSink, to receive the subsequent notifications. This advise sink object must have already been allocated; it cannot be NULL.
  • lpulConnection
    [out] Reference to a nonzero number that represents the connection between the caller's advise sink object and the session.

Return Values

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

  • S_OK
    Indicates success.


Advise establishes a connection between the caller's advise sink object and the session. This connection is used to send notifications to the advise sink when one or more events as specified in the ulEventMask parameter occur to the session.

The ulEventMask parameter is a bitmask composed of one or more of the flags described in the following table.

Flag Value Description
fnevObjectCopied 0x00000040 Registers for notifications about an object being copied.
fnevObjectCreated 0x00000004 Registers for notifications about the creation of a new object.
fnevObjectDeleted 0x00000008 Registers for notifications about an object being deleted.
fnevObjectModified 0x00000010 Registers for notifications about an object being modified.
fnevObjectMoved 0x00000020 Registers for notifications about an object being moved.

To send a notification, MAPI calls the registered advise sink's IMAPIAdviseSink::OnNotify method. One of the parameters to OnNotify, a notification structure, contains information that describes the specific event.

After a call to Advise has succeeded and before IMAPISession::Unadvise has been called to cancel the registration, be prepared for the advise sink object to be released. You should release your advise sink object after Advise returns unless you have a specific long-term use for it.


Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: mapix.h
Library: cemapi.lib

See Also

IMAPISession | IMAPIAdviseSink::OnNotify | IMAPISession::Unadvise | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.