How to set a phone number via entity_metadata_wrapper? I am trying to update a user programmatically in Drupal 7.

User records have multiple custom fields, configured via admin interface #overlay=admin/config/people/accounts/fields

My code sets text and datetime fields fine, but fails to update a phone number field.

Error message:

EntityMetadataWrapperException: Unknown data property field_mobilephone.
in EntityStructureWrapper-&gt;getPropertyInfo()
(line 335 of /Applications/MAMP/htdocs/sites/all/modules/entity/includes/entity.wrapper.inc)


Code:

  $new_user = user_save(null, $fields);

  $obj = entity_metadata_wrapper('user', $new_user);
  $obj-&gt;field_firstname-&gt;set($_REQUEST['firstname']);
  $obj-&gt;field_lastname-&gt;set($_REQUEST['lastname']);
  $obj-&gt;field_mobilephone-&gt;set($_REQUEST['mobilephone']);


When I do var_dump($obj) I can see all configured text fields in the output, but not the phone number fields.

Field type is 'phone number', provided by the cck_phone-7.x-1.x-dev module (I couldn't find any other place where it could come from).

So question is how do I set phone number field via entity_metadata_wrapper?
I got around this problem by using the following snippet just before the user_save(..) call:

$fields['field_mobilephone'][LANGUAGE_NONE][0]['number'] = $_REQUEST['mobilephone'];
$fields['field_mobilephone'][LANGUAGE_NONE][0]['country_codes'] = 'au';


This approach bypasses the entity_metadata_wrapper altogether.
Pretty sure there's a cleaner way, but I'm not yet aware of it.