Indicates the result of an attempt to remove a contact from the Messenger object's contact list. Scriptable.
Syntax
HRESULT OnContactListRemove( [in] LONG hr, [in] IDispatch* pMContact ); |
Parameters
- hr
-
[in] Success or error code as a LONG.
An error result for hr might result in all other event parameters being meaningless, null, or otherwise invalid. Always check for a successful hr before attempting to use the other event parameters. For a table of MSGR_E_* constants, see Error Codes.
Returns one of the following values:
- S_OK. A user is successfully removed from the contact list.
- MSGR_E_USER_NOT_FOUND. The contact specified to be removed is
not found in the contact list.
- MSGR_E_UNEXPECTED. The server returned an unexpected error
code.
- MSGR_E_SERVER_TOO_BUSY. The server is not processing requests
or not accepting new connections.
- MSGR_E_SERVER_UNAVAILABLE. The server is contacted, but is
unavailable for unspecified reasons.
- S_OK. A user is successfully removed from the contact list.
- pMContact
-
[in] Pointer to an IDispatch interface on the IMessengerContact object that corresponds to the removed contact.
Return Value
The implementer of this event handler will determine what value should be returned.
Remarks
This event comes in response to the IMessengerContacts::Remove method. If the call to IMessengerContacts::Remove failed, this event cannot be generated. For example, attempting to remove a user without specifying a string for user name is prevented by the IMessengerContacts::Remove method. In this case, the method returns E_FAIL even before submission to the protocol and generates no event.
Removing a MessengerContact object from the contact list does not release it from memory or otherwise deallocate it. Clients can deallocate the MessengerContact object as soon as it is removed from the contact list or later after the client has shut down. A MessengerContact object that is not in the contact list is still a valid object (for example, it could be used as the VARIANT argument in a IMessenger::InstantMessage call). After the object or contact is out of the contact list, no status updates are received from the server about this contact. As a result, when starting an instant message as described, the client is not able to determine whether that contact is online until the message is sent.
This event is also issued whenever you attempt to remove a contact from the contact list through user action in the UI.
Example
The example code examines the HRESULT value returned in the hr parameter. A non-zero value indicates a failure to remove the contact. If the contact was successfully removed, a notification is displayed on the application console window.
Copy Code | |
---|---|
void communicator_OnContactListRemove(int hr, object pMContact) { if (hr == 0) //0 is equated to S_OK { Console.WriteLine("EVENT: " + "CONTACT REMOVED FROM LIST: HRESULT-" + hr.ToString()); } } |
Requirements
- Client
-
Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .
- Server
-
Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.
- Product
-
Microsoft Office Communicator 2007 Automation API
- IDL file
-
Msgrua.idl