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我编辑并添加了权限。所以一切都被检查。仍然得到相同的回应。 –
我假设你的驱动器上有一些文件或文件夹。如果可以,您可以提供返回给您的某个电话的响应标题? –