Freigeben über


IMessengerPrivate::AddContact method

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

Adds a contact to the contact list with no prompting or notification UI.

Syntax

HRESULT AddContact(
  [in] BSTR    bstrSiginName,
  [in] VARIANT vService
);

Parameters

bstrSiginName [in]

BSTR that defines the sign-in name of the contact to be added. The method will run regardless of whether this parameter is valid. The OnContactListAdd event will contain the results from this method call.

vService [in]

VARIANT that defines the service. For more information, see Remarks.

Return value

This method can return one of these values.

Return code Description
S_OK
The contact was added to the contacts list.
E_POINTER
The parameter bstrSiginName resolved to a null value.
E_INVALIDARG
The parameter bstrSiginName is not valid for this method.
MSGR_E_NOT_LOGGED_ON
The service is not logged on.
E_FAIL
The method call has failed due to a catastrophic error.
MSGR_E_API_LOCKED
Windows Messenger 5.0 and later. The application has called the Microsoft .NET Messenger Service without unlocking it. For more information, see Messenger Lock and Key API.

Remarks

The vService parameter can be specified as a BSTR containing the ID (not the name) of the service, or it can also be a pointer to an IDispatch of a MessengerService object.

The vService parameter can be specified as a BSTR containing the ID (not the name) of the service.

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

0x80000003 The parameter bstrSiginName is not valid for this method.
0x80004003 The parameter bstrSiginName resolved to a null value.
0x80004005 The method call has failed due to a catastrophic error.
0x8100031e The service is not logged on.
0x81000752 Windows Messenger 5.0 and later. The application has called the Microsoft .NET Messenger Service without acquiring a ID/Key pair.

Note

This method is not available for scripting languages.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
End of client support
Windows XP
End of server support
Windows Server 2003
Product
Messenger 4.5
Header
Msgrpriv.h
IDL
Msgrpriv.idl
DLL
Msgsc.dll

See also

IMessengerPrivate

EnableAlertEvents

OnContactListAdd

Messenger Lock and Key API

Messenger Session Invite and Messenger Private APIs