Share via


IMessengerContact::ServiceID property

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

Retrieves the service ID, a GUID, for the contact associated with this MessengerContact object.

This property is read-only.

Syntax

HRESULT get_ServiceID(
  [out, retval] BSTR *pbstrServiceID
);

Property value

Pointer to a BSTR that contains a GUID that uniquely identifies the service used by this contact. This can be a secondary service contact and therefore may return an ID other than the one for the Microsoft .NET Messenger Service.

Error codes

Returns one of the following values.

Name Meaning
S_OK
Success.
E_INVALIDARG
General internal failure.
RPC_X_NULL_REF_POINTER
pbstrServiceID is a NULL pointer.

Remarks

The following table lists error codes returned by this method.

Error Code Meaning
0x80004005 General internal failure.

Clients may wish to compare MyServiceId (the client's service ID) to ServiceID. A match of services may allow service-specific functionality that is not possible if the local and remote users are on different services.

Stored service IDs for secondary services may also be useful if it is necessary to create MessengerContact objects that correspond to secondary service contacts (through GetContact, which requires the service ID as a parameter).

Note

This property is available for scripting languages.

Examples

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

Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContact As MessengerAPI.IMessengerContact

Private Sub btnServiceID_Click()
    On Error Resume Next
    Dim strSigninName As String
    Dim strServiceID As String
    'Get selected contact
    strSigninName = ListContact.SelectedItem.SubItems(2)
    strServiceID = ListContact.SelectedItem.SubItems(5)
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    MsgBox("Contact ServiceID: " & CStr(MsgrContact.ServiceId))
    ErrorTrap ("Contact.ServiceID") '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

IMessengerContact

MyServiceName

ServiceName