IMessengerContact::ServiceID Property

[ServiceID is no longer available in 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 (get)

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

Parameters

pbstrServiceID [out]

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.

Return Value

Returns one of the following values: 

Return codeDescription
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 CodeMeaning
0x80004005General 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

Header

Msgrua.h

IDL

Msgrua.idl

DLL

Msgsc.dll

See Also

IMessengerContact
MyServiceName
ServiceName

 

 

Send comments about this topic to Microsoft

Build date: 6/30/2010

Show: