Device Phone Number

// Expert user has replied.
M Marc Fluhrer 3 years 6 months ago
6 2 0

Is there a way through a registry entry or SymScript to get the phone number for a device? This seems to be obtained from a Microsoft API call that does not seem to work for the customer, but I was wondering if anyone has had luck using another method. The customer is not using MSP, so they cannot get it that way. Thanks for any help.

Please Register or Login to post a reply

2 Replies

E Efkan YILMAZ

The phone number needs to be stored on the SIM for the API's to work. There are API's in SymScript - but these only return the phone number if stored on the SIM. Most carriers do not store the number on the SIM.

M Marc Fluhrer

Just some information from the customer I wanted to add so it can be tracked:
I’d seen the referenced article - but it states:

”For this sample, it is assumed that the mobile device uses a SIM with the device's phone number programmed into it. Some devices do not store their phone number on a SIM. For these devices, there is no way to programmatically determine the device's phone number and this sample will not successfully return the number.”

As none of the Intermecs have SIM cards and I don’t believe the new ES400s from Verizon will have SIM cards, I had rejected this as a solution.

 

A new search  on this topic lead me to the following article http://msdn.microsoft.com/en-us/library/aa446543.aspx which again references SIM API calls.

“To get the SIM user's phone number from your code using C#, call: Microsoft.Wireless.Sim.GetPhoneNumber() (which returns a string)”

Even though the documentation clearly states that it only works with SIM card equipped devices  I gave it a try on the ES400 you sent over and low and behold - it worked on both that device and the CN3.

 

Microsoft’s documentation was also wrong on how to invoke the method. It should be called from C# like this:

Microsoft.Wireless.PhoneAddress phoneAddress = new Microsoft.Wireless.PhoneAddress();

phoneAddress = Microsoft.Wireless.Sim.GetPhoneNumber();

string telephoneNumber = phoneAddress.Address.ToString();

 

NOTE: The undocumented Micorsoft.Wireless namespace can only be obtained by downloading the example given on that article and installing it.

CONTACT
Can’t find what you’re looking for?