0
我試過API來獲取iOS SDK中的文件。
我已經註冊了所有範圍的應用程序來讀取/讀取文件訪問應用程序。我能夠成功地使用示例代碼發送郵件。 我試過的API的圖形瀏覽器 https://graphexplorer2.azurewebsites.net/?UrlRequest=GET&text=https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fme%2Fdrive%2Froot%2FchildrenMicrosoft Graph API:獲取文件列表API,給出空陣列
請求片段:
AuthenticationManager *authManager = [AuthenticationManager sharedInstance];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://graph.microsoft.com/v1.0/me/drive/root/children"]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"application/json, text/plain, */*" forHTTPHeaderField:@"Accept"];
NSString *authorization = [NSString stringWithFormat:@"Bearer %@", authManager.accessToken];
[request setValue:authorization forHTTPHeaderField:@"Authorization"];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(conn) {
NSLog(@"Connection Successful");
} else {
NSLog(@"Connection could not be made");
}
[conn start];
響應:
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('<user-email>')/drive/root/children","value":[]}
在此先感謝您的幫助:)
它更多的是評論而不是回答。 – Panther
@Marek我編輯並添加了權限。所以一切都被檢查。仍然得到相同的迴應。 –
我假設你的驅動器上有一些文件或文件夾。如果可以,您可以提供返回給您的某個電話的響應標題? –