Indicates that the block settings of a contact in the local client's contact list have changed. Queries whether the contact is blocked by the local client user. Not scriptable.
Syntax
HRESULT OnContactBlockChange( [in] LONG hr, [in] IDispatch* pContact, [in] VARIANT_BOOL pBoolBlock ); |
Parameters
- hr
-
[in] Success or error code as a LONG. For a table of the MSGR_E_* constants, see Error Codes.
An error result for hr can 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.
Returns one of the following values:
- S_OK. A user is successfully blocked or unblocked.
- MSGR_E_USER_NOT_FOUND. The user specified to be blocked or
unblocked does not exist.
- 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 able to be contacted,
but is unavailable for unspecified reasons.
- S_OK. A user is successfully blocked or unblocked.
- pContact
-
[in] Pointer to an IDispatch interface on the IMessengerContact object where a change in block value is attempted.
- pBoolBlock
-
[in] One of two possible values of the VARIANT_BOOL constant enumeration defined by the Component Object Model (COM). VARIANT_TRUE indicates that this contact is blocked. VARIANT_FALSE indicates that this contact is not blocked. This value is potentially null or otherwise not useful if hr in the event returned any error code.
Return Value
The implementer of this event handler will determine what value should be returned.
Remarks
If the user is not in the contact list, the application handling this event cannot be notified of subsequent changes of the property value after the IMessengerContact instance representing the user is first created. To refresh the property value, the handler must release and recreate the IMessengerContact instance.
Example
The pContact object is cast to an object of type IMessengerContact so that all of the methods and properties of the interface are available. In this example, the FriendlyName property is used to display the name of the contact whose block status has changed.
Copy Code | |
---|---|
void communicator_OnContactBlockChange( int hr, object pContact, bool pBoolBlock) { if (hr == 0) { IMessengerContact imContact = (IMessengerContact)pContact; StringBuilder sb = new StringBuilder(); sb.Append( " CONTACT BLOCK CHANGE: HRESULT-" + formReturnErrors.returnComError(hr)); sb.Append( " Contact Name:" + imContact.FriendlyName); sb.Append( " Block Status: " + pBoolBlock.ToString()); Console.WriteLine( "EVENT: " + sb.ToString()); myContactList.updateContactStatus( imContact, imContact.Status); } } |
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