【问题标题】:office 365 file Get drive properties returning falseoffice 365 文件获取驱动器属性返回 false
【发布时间】:2015-04-22 13:37:25
【问题描述】:

我正在尝试使用 office 365 REST API 获取 onedrive 驱动器属性,但是当我 var_dump 我的响应时,我得到的响应为假。下面是我的代码。

$file_api = "https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files"; 
             $headers = array(
                'Content-Type: application/json',
                'Authorization: Bearer'.$token, // Always need our auth token!
            );
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $file_api);            
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($ch);           
            curl_close($ch);
            var_dump($result);

谁能告诉我我在这里做错了什么?

我正在引用此链接。

https://msdn.microsoft.com/office/office365/APi/files-rest-operations#DriveoperationsGetdriveproperties

回复是

array (
  'url' => 'https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files',
  'content_type' => NULL,
  'http_code' => 0,
  'header_size' => 0,
  'request_size' => 0,
  'filetime' => -1,
  'ssl_verify_result' => 0,
  'redirect_count' => 0,
  'total_time' => 30.749314999999999,
  'namelookup_time' => 0.20429800000000001,
  'connect_time' => 0.20474100000000001,
  'pretransfer_time' => 0,
  'size_upload' => 0,
  'size_download' => 0,
  'speed_download' => 0,
  'speed_upload' => 0,
  'download_content_length' => -1,
  'upload_content_length' => -1,
  'starttransfer_time' => 0,
  'redirect_time' => 0,
  'redirect_url' => '',
  'primary_ip' => '104.146.150.43',
  'certinfo' => 
  array (
  ),
  'primary_port' => 443,
  'local_ip' => '192.168.8.46',
  'local_port' => 54470,
)

提前致谢

【问题讨论】:

    标签: php rest office365


    【解决方案1】:

    您需要将 url 中的 {tenant} 替换为您的 Office 365 租户名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-22
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多