i've been trying import contacts outlook 365 database. have no issue getting names, emails, addresses, etc.
but when want notes located on second page of contacts in outlook 365 come out empty.
i'm using php code, calling api url:
https://outlook.office.com/api/v2.0/me/contacts
with no particular parameters. login, tokens, etc. part taken care of , functioning properly.
here example of array receive call print_r :
array ( [id] => ... [createddatetime] => ... [lastmodifieddatetime] => ... [changekey] => ... [categories] => array ( [0] => ... ) [parentfolderid] => ... [birthday] => [fileas] => ... [displayname] => ... [givenname] => ...[initials] => [middlename] => [nickname] => ... [surname] => ... [title] => [yomigivenname] => [yomisurname] => [yomicompanyname] => [generation] => [emailaddresses] => array ( [0] => array ( [name] => ...[address] => ...) ) [imaddresses] => array ( ) [jobtitle] => ... [companyname] => ... [department] => [officelocation] => ...[profession] => [businesshomepage] => ... [assistantname] => [manager] => [homephones] => array ( ) [mobilephone1] => ... [businessphones] => array ( [0] => ... ) [homeaddress] => array ( ) [businessaddress] => array ( [street] => ... [city] => ...[state] => ...[countryorregion] => ...[postalcode] => ...) [otheraddress] => array ( ) [spousename] => [personalnotes] => [children] => array ( ) )
`personalnotes' empty every time, though notes in contacts contain plenty of text.
the function making api call one:
public function makeapicall($method, $url, $payload = null) { // generate list of headers send. $headers = array( "user-agent: outlook/1.0", // sending user-agent header best practice. "authorization: bearer ".$this->access_token, // need our auth token! "accept: text/*, application/xml, application/json; odata.metadata=none", // accept json response. "client-request-id: ".self::makeguid(), // stamp each new request new guid. "return-client-request-id: true", // tell server include our request-id guid in response. "x-anchormailbox: ".$this->user_email // provider user's email optimize routing of api call ); // print_r($headers); $curl = curl_init(); switch(strtoupper($method)) { case "get": error_log("doing get"); break; case "post": // payload pour post doit etre json_encode!!! error_log("doing post"); $headers[] = "content-type: application/json"; curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $payload); break; case "patch": error_log("doing patch"); $headers[] = "content-type: application/json"; curl_setopt($curl, curlopt_customrequest, "patch"); curl_setopt($curl, curlopt_postfields, $payload); break; case "delete": error_log("doing delete"); curl_setopt($curl, curlopt_customrequest, "delete"); break; default: error_log("invalid method: ".$method); exit; } curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_returntransfer, true); curl_setopt($curl, curlopt_httpheader, $headers); curl_setopt($curl, curlopt_ssl_verifypeer, false); $response = curl_exec($curl); error_log("curl_exec done."); $httpcode = curl_getinfo($curl, curlinfo_http_code); if ($httpcode >= 400) { return array('errornumber' => $httpcode, 'error' => 'request returned http error '.$httpcode); } $curl_errno = curl_errno($curl); $curl_err = curl_error($curl); if ($curl_errno) { $msg = $curl_errno.": ".$curl_err; error_log("curl returned error: ".$msg); curl_close($curl); return array('errornumber' => $curl_errno, 'error' => $msg); } else { error_log("response: ".$response); curl_close($curl); return json_decode($response, true); } }
any appreciated, thanks!
interesting. see too, if set note in desktop outlook. if set in outlook web app, works fine. can go edit 'broken' 1 in owa , fixes it.
so temporary answer, can edit contacts in owa fix them. i'll update answer once have better answer.
Comments
Post a Comment