This documentation is archived and is not being maintained.

IMessenger::get_MyPhoneNumber

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 stored phone number of the local client user. Not scriptable.


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

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.

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.

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.

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.

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());
}

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

Show: