Retrieves a Boolean value that declares whether the contact associated with this MessengerContact object is actually the current client user. Scriptable.

Syntax

HRESULT IsSelf(
   [out,
   retval] VARIANT_BOOL* pBoolSelf
);

Parameters

pBoolSelf

Pointer to a VARIANT_BOOL that declares whether this MessengerContact object is the same user as the current client user (determined by a comparison of sign-in names, which are unique per service). VARIANT_TRUE means the contact is the current client user. VARIANT_FALSE means the contact is not the current client user.

Return Value

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.

S_OK

Success.

E_FAIL

pbstrFriendlyName returns a null string.

RPC_X_NULL_REF_POINTER

pBoolSelf is a null pointer.

Remarks

Although users can add themselves as a contact, Office Communicator Automation API blocks users from sending instant messages to themselves. Other clients can duplicate this enforcement by checking this method's value before calling methods such as IMessenger::InstantMessage method.

If this method is called while the client is offline, it does not fail but always returns false, even if the user represented by the MessengerContact object and the local client user are the same.

Example

The following example code reads the IsSelf property of the IMessengerContact object, IMcontact. If IsSelf returns a false value, the IM conversation is initiated.

Copy Code
try
{
   IMessengerContact IMContact = (IMessengerContact)communicator.GetContact("jaya@contoso.com", communicator.MyServiceId);
   if (IMContact != null && IMContact.IsSelf == false)
   {
	IM_Window = (IMessengerConversationWnd)communicator.InstantMessage(IMContact);
   }
}
catch (COMException CEIS)
{
   Console.WriteLine(CEIS.ErrorCode.ToString());
}

Requirements

Client

Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .

Server

Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.

Product

Microsoft Office Communicator 2007 Automation API

IDL file

Msgrua.idl

See Also