我试图让microsoft Outlook邮件用户使用microsoft 365 graph API配置照片。
我在应用程序上设置了以下权限User.Read, User.ReadWrite,User.ReadBasic.All,User.Read.All,User.ReadWrite.All ,但它没有显示任何个人资料照片,而用户的个人资料照片已经上传到她的Outlook邮件帐户....
以下是代码
<?php
session_start();
echo $acc= $_SESSION['access_token'];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://graph.microsoft.com/v1.0/me/photo",
//CURLOPT_URL => "https://graph.microsoft.com/v1.0/me",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
//CURLOPT_CUSTOMREQUEST => "GET",
//CURLOPT_POSTFIELDS => "$data",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer $acc"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
print_r($response);
$json = json_decode($response);
$res = $json->{'items'};
if ($err) {
echo "cURL Error #:" . $err;
} else {
//echo $response;
}
?>
答案 0 :(得分:2)
你几乎就在那里。您想要使用的是
https://graph.microsoft.com/v1.0/me/photo/$value