fix sharepoint space in cn

pull/41/head
qkqpttgf 2020-03-26 20:40:50 +08:00 committed by GitHub
parent 0fb6614332
commit 5c42aef340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -173,20 +173,21 @@ function config_oauth()
function get_siteid($access_token)
{
if (getConfig('Drive_ver')=='MS') $url = 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname');
if (getConfig('Drive_ver')=='CN') $url = 'https://microsoftgraph.chinacloudapi.cn/v1.0/sites/root:/sites/'.getConfig('sharepointname');
$i=0;
$response = [];
while ($response['stat']!=200&&$i<4) {
$response = curl_request('https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname'), false, ['Authorization' => 'Bearer ' . $access_token]);
while ($url!=''&&$response['stat']!=200&&$i<4) {
$response = curl_request($url, false, ['Authorization' => 'Bearer ' . $access_token]);
$i++;
echo 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname').$response['stat'].$response['body'].'
';
//echo 'https://graph.microsoft.com/v1.0/sites/root:/sites/'.getConfig('sharepointname').$response['stat'].$response['body'].'
//';
}
if ($response['stat']!=200) {
error_log('failed to get siteid. response' . json_encode($response));
throw new Exception($response['stat'].', failed to get siteid.'.$response['body']);
}
return json_decode($response['body'],true)['id'];
//$_SERVER['api_url'] = 'https://graph.microsoft.com/v1.0/sites/' . $tmp['siteid'] . '/drive/root';
//setConfig($tmp);
//error_log('failed to get siteid. response' . json_encode($response));
//throw new Exception($response['stat'].', failed to get siteid.'.$response['body']);
}
function getListpath($domain)