从outlook Saying
更新联系人时收到错误{"错误":{"代码":" ErrorInvalidRequest","消息":" OData请求不受支持。"}}
这是我的JSON
$Sync1 =array
(
"GivenName"=> "Manjit",
"BusinessPhones"=> [
"+1 732 555 0102"
],
"HomeAddress"=> array (
"Street"=> "Some street",
"City"=> "Seattle",
"State"=> "WA",
"PostalCode"=> "98121"
),
"Birthday"=> "1974-07-22"
);
$JsonEncodedData1 = json_encode($Sync1);
这是我的CURL操作
$headers = array(
"Authorization: Bearer ". $_SESSION['$Acce-token'],
"Accept: application/json",
"Content-type: application/json"
);
$id="AQ0zxW1WLhZfQcAHy4NAourakufhB9QQPde-QAAAgEOAAAAHy4NAourakuf
B9QQPde-QAAAZ1NrwAAAA=="; //This is valid ID
$curl2 = curl_init("https://outlook.office.com/api/v2.0/me/contacts/".$id);
curl_setopt($curl2, CURLOPT_HEADER, true);
curl_setopt($curl2, CURLOPT_VERBOSE, true);
curl_setopt($curl2, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl2, CURLOPT_POST, true);
curl_setopt($curl2, CURLOPT_POSTFIELDS, $JsonEncodedData1);
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl2, CURLOPT_TIMEOUT, 10);
$curl_Response = curl_exec($curl2);
curl_close($curl2);
我该如何解决这个问题?
答案 0 :(得分:0)
您缺少preferred_username(该特定用户的电子邮件ID)您必须在向Outlook推送联系人的同时在标题中传递电子邮件ID
$ headers = array(
System.Enum