dcblogdev / laravel-microsoft-graph

Laravel package for Microsoft Graph API (Microsoft365)
https://dcblog.dev/docs/laravel-microsoft-graph
Other
122 stars 52 forks source link

Can't create a contact with "businessPhones" or "mobilePhone" #22

Closed Badr1600 closed 2 years ago

Badr1600 commented 2 years ago

Whenever I try to create a new contact with businessPhones or mobilePhone this error message is returned.

{"error":{"code":"UnableToDeserializePostBody","message":"were unable to deserialize "}}

$data = [
    'displayName' => $crm_cascontact->surname.' '.$crm_cascontact->givenName,
    'givenName' => $crm_cascontact->givenName,
    'surname' => $crm_cascontact->surname,
    'mobilePhone' => $crm_cascontact->mobilePhone
];

It appears that the store function works only with these parameters:

$data = [
    'displayName' => 'John Smith',
    'givenName' => 'John Smith',
    'emailAddresses' => [
        [
            'address' => 'j.smith@domain.com',
            'name' => 'John Smith'
        ]
    ]
];
dcblogdev commented 2 years ago

I'm unable to replicate this, this works for me:

$data = [
    'displayName' => 'demo',
    'givenName' => 'Demo Smith',
    'surname' => 'Smith',
    'mobilePhone' => '07429561809'
];

$emails = MsGraph::contacts()->store($data);