Retrieves the friendly name of the contact associated with this MessengerContact object. Scriptable only locally for getting the property value.


HRESULT FriendlyName(
   retval] BSTR* pbstrFriendlyName



Pointer to a BSTR that contains the friendly name of this user.

Return Value

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




pbstrFriendlyName returns a null string.


The VARIANT handling library returns an error.


pbstrFriendlyName is a null pointer.


The friendly name is used in conjunction with the sign-in name primarily for UI display. Because a friendly name is not guaranteed to be unique, it is good practice to display both the sign-in and friendly names for any contact viewed within a client.

If the user, as represented by this IMessengerContact interface instance, is not in the caller's contact list, the sign-in name (for example, "") is returned immediately. This is because the display name must be fetched from the server. That operation is asynchronous, and the correct value is returned at a later time in an DMessengerEvents::OnContactFriendlyNameChange event. However, the caller is only notified of this change once every time an IMessengerContact instance is created for this user. Hence, the caller might not be notified of changes in the friendly name of this user made by any other client, unless the caller releases and recreates the user instance.


The example code determines that the contact object has been instantiated and then queries the FriendlyName property to retrieve the friendly name of the contact. The resultant string value is displayed on the application console window.

Copy Code
private void findContactFriendlyNameButton_Click(object sender, EventArgs e)
  if (contact != null)
	Console.WriteLine("Contact friendly name: " + contact.FriendlyName);
	catch (COMException CEFN)




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. .


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


Microsoft Office Communicator 2007 Automation API

IDL file


See Also