Share via


IMessengerGroup::RemoveContact method

[RemoveContact is no longer available for use as of Windows Vista. See Windows Messenger for more information.]

Removes a contact from the group.

Syntax

HRESULT RemoveContact(
  [in] VARIANT vContact
);

Parameters

vContact [in]

Type: VARIANT

VARIANT that can take as its value either a VT_BSTR string or a VT_DISPATCH pointer to an existing MessengerContact object. If the input value type is a string, this method creates a new MessengerContact object internally. The string should be the full sign-in name. For a netmsgrsvc contact, this should include the "at" sign (@) and domain name. If the input value type is a pointer to an existing MessengerContact object (should be type VT_DISPATCH), the existing object is used.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
S_OK
Success.
E_INVALIDARG
vContact is NULL, points to a NULL string, or points to a string that has a space as the first character.
- or -
vContact is VT_BStr that exceeded 129 characters (130 if the string terminator is included in the count. This allows for a 64-character sign-in name, @ symbol, and a 64-character domain name. This format does not have to be followed.)
- or -
vContact is VT_BStr and contains a carriage return or linefeed.
E_FAIL
General failure.
MSGR_E_NOT_LOGGED_ON
Client is offline.
MSGR_E_USER_NOT_FOUND
The user specified to be removed does not exist.

Remarks

The following table lists the error codes returned by this method.

0x80004005 General failure.
0x80070057 vContact is a NULL string, or a string that has a space as the first character.
- or - vContact is VT_BStr that exceeded 129 characters (130 if the string terminator is included in the count. This allows for a 64-character sign-in name, @ symbol, and a 64-character domain name. This format does not have to be followed.)
- or - vContact is VT_BStr and contains a carriage return or linefeed.
MSGR_E_NOT_LOGGED_ON Client is offline.
MSGR_E_USER_NOT_FOUND The user specified to be removed does not exist

Note

This method is not available for scripting languages.

Examples

The following Visual Basic example shows the use of this method.

Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrGroup As MessengerAPI.IMessengerGroup

Private Sub btnGroupRemoveContact_Click()
    On Error Resume Next
    FormAddRemoveContact_Group.Show vbModal 'Get user input
    If bDialogCancel = False Then
        MsgrGroup.RemoveContact strContactName
        populateListView    'Refresh contact list
    End If
    ErrorTrap ("MsgrGroup.RemoveContact")   'Error handling routine
End Sub

Requirements

End of client support
Windows XP
End of server support
Windows Server 2003
Header
Msgrua.h
IDL
Msgrua.idl
DLL
Msgsc.dll

See also

IMessengerGroup