IMessengerGroup::AddContact method

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

Adds a contact to the group.

Syntax

HRESULT AddContact(
  [in] VARIANT vContact
);

Parameters

vContact [in]

Type: VARIANT

VARIANT that defines the contact to add to the group.

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 added 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 added 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 btnGroupAddContact_Click()
    On Error Resume Next
    FormAddContact_Group.Show vbModal   'Get user input
    If bDialogCancel = False Then
        MsgrGroup.AddContact strContactName
        populateListView    'Refresh contact list
    End If
    ErrorTrap ("MsgrGroup.AddContact")  '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