[in] The byte count in the entry identifier pointed to by the lpEntryID parameter.
[in] A pointer to the entry identifier of the address book or message store object about which notifications should be generated, or NULL, which indicates that the client is registering to receive notifications about events that affect only the session.
[in] A mask of values that indicate the types of notification events that the client is interested in and should be included in the registration. If lpEntryID is NULL, MAPI automatically registers the client for critical error events that affect only the session. When lpEntryID points to an entry identifier, the following values are valid for the ulEventMask parameter:
Registers for notifications about severe errors, such as insufficient memory.
Registers for notifications about events specific to a particular address book or message store provider and about session shut down.
Registers for notifications about the arrival of new messages.
Registers for notifications about the creation of a new object.
Registers for notifications about an object being copied.
Registers for notifications about an object being deleted.
Registers for notifications about an object being modified.
Registers for notifications about an object being moved.
Registers for notifications about the completion of a search operation.
[in] A pointer to an advise sink object to receive the subsequent notifications. This advise sink object must have already been allocated.
[out] A pointer to a nonzero number that represents the connection between the caller's advise sink object and the session.
The IMAPISession::Advise method establishes a connection between the caller's advise sink object, the session and, optionally, a service provider. This connection is used to send notifications to the advise sink when one or more events specified in the ulEventMask parameter occur to the object pointed to by lpEntryID. When lpEntryID is NULL, the target object is the session and notifications are sent only for critical errors and extended events.
When lpEntryID points to a valid entry identifier, MAPI calls the Advise method of the logon object that belongs to the responsible service provider. For example, if lpEntryID points to the entry identifier of a distribution list, MAPI calls the appropriate address book provider's IABLogon::Advise method.
To send a notification, either the service provider or 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.
On systems that support multiple threads of execution, the call to OnNotify can also occur on any thread at any time. If you need assurance that notifications will occur only at a particular time on a particular thread, call the HrThisThreadAdviseSink function to generate the advise sink object that you pass to the Advise method.
To determine when a client has logged off, register for notifications in your service provider by calling Advise with lpEntryID set to NULL and cbEntryID set to 0. When the logoff occurs, you will receive an fnevExtended notification.
After a call to Advise has succeeded and before IMAPISession::Unadvise has been called to cancel the registration, release your advise sink object unless you have a specific long-term use for it.