Retrieves the stored phone number of the local client user. Not scriptable.

Syntax

HRESULT get_MyPhoneNumber(
   [in] MPHONE_TYPE PhoneType,
   [out,
   retval] BSTR* pbstrNumber
);

Parameters

PhoneType

A value of the enumeration.

pbstrNumber

A string (not a numeric data type) that contains the requested phone number. This number can contain punctuation, depending on how the data was collected.

Return Value

Returns one of the following values.

S_OK

Success.

RPC_X_NULL_REF_POINTER

pbstrNumber is a null pointer.

MSGR_E_NOT_LOGGED_ON

The client is not signed in to the primary service at the time this method is called.

E_FAIL

The requested phone number does not exist. pbstrNumber will be a null string.

Remarks

This method replaces the deprecated MyPhoneNumber property. The method returns a string representing the requested telephone number formatted as a TEL URI (tel:+19999999999). The acceptable input parameter values can be found in the MPHONE_TYPE enumeration. The telephone numbers returned by this method are those that are input on the Phones tab in the Options dialog box in the Office Communicator UI.

Example

The following example calls get_MyPhoneNumber on communicator, an IMessenger interface object. The method returns the logged-on user's work telephone number. The telephone number string is output to the application console window.

Copy Code
string myHomePhone = null;
try
{
	myHomePhone = communicator.get_MyPhoneNumber(MPHONE_TYPE.MPHONE_TYPE_WORK);
	if (myHomePhone != null)
		Console.WriteLine(myHomePhone);
}
catch (COMException PNCE)
{
	Console.WriteLine(PNCE.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

IMessenger::Phone