Called by the API to indicate that the local user's friendly name has been changed or that a change was attempted. Not scriptable.

Syntax

HRESULT OnMyFriendlyNameChange(
   [in] LONG hr,
   [in] BSTR bstrPrevFriendlyName
);

Parameters

hr

[in] Success or error code as LONG. S_OK is the only result returned currently.

bstrPrevFriendlyName

[in] A BSTR that contains the current client user's previous friendly name.

Return Value

The implementer of this event handler will determine what value should be returned.

Remarks

Office Communicator Automation API does not have a property or method to put or set the user's friendly name information. This event fires only if the friendly name is changed through administrator action.

After receiving this event, the following C# call should be issued immediately to get the new friendly name of the current client user.

Copy Code
string MyFriendlyName = communicator.MyFriendlyName

The previous friendly name might be permanently lost if it is not returned in the events. It can be used to check the client UI to be sure it is removed.

Example

This example code illustrates the task of responding to a friendly name change by displaying both the old (represented by the bstrPrevFriendlyName parameter) and new friendly name in the application console window.

Copy Code
void communicator_OnMyFriendlyNameChange(
	 int hr, 
	 string bstrPrevFriendlyName)
{
	if (hr == 0)
	{
		StringBuilder sb = new StringBuilder();
		sb.Append(
		 " CHANGE MY FRIENDLY NAME: result-" +
		 formReturnErrors.returnComError(hr));

		sb.Append(
		 " Old friendly name: " +
		 bstrPrevFriendlyName);

		sb.Append(
		 " New friendly name: " +
		 communicator.MyFriendlyName);

		Console.WriteLine(
			 "EVENT: " +
			 sb.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