IMessengerContact::FriendlyName
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Retrieves the friendly name of the contact associated with this MessengerContact object. Scriptable only locally for getting the property value.
Syntax
HRESULT FriendlyName(
[out,
retval] BSTR* pbstrFriendlyName
);
Parameters
- 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.
- S_OK
Success.
- E_FAIL
pbstrFriendlyName returns a null string.
- E_OUTOFMEMORY
The VARIANT handling library returns an error.
- RPC_X_NULL_REF_POINTER
pbstrFriendlyName is a null pointer.
Remarks
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, "someone@company.com") 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.
Example
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.
private void findContactFriendlyNameButton_Click(object sender, EventArgs e)
{
if (contact != null)
{
try
{
Console.WriteLine("Contact friendly name: " + contact.FriendlyName);
}
catch (COMException CEFN)
{
Console.WriteLine(CEFN.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
Reference
IMessengerContact::SigninName
DMessengerEvents::OnContactFriendlyNameChange