我正在尝试使用Microsoft Graph SDK获取用户的联系人。我可以使用graphClient.me()
获取用户详细信息,但是当我尝试获取联系人列表时出现错误:
Graph SDK ERROR :
Error from data task :
Error Domain=com.microsoft.graph.errors
Code=400 "bad request"
UserInfo={
NSLocalizedDescription=bad request,
error= AuthenticationError : Error authenticating with resource
}
Graph SDK ERROR : Caused by request <NSMutableURLRequest: 0x1738bc70> {
URL: https://graph.microsoft.com/v1.0/me/contacts
}
我的代码:
self.graphClient.me().contacts().request().getWithCompletion {
(_ contacts: MSCollection?,
_ nextRequest: MSGraphUserContactsCollectionRequest?,
_ error: Error?) in
if error == nil {
print("contacts \(contacts)")
}
else {
print("error \(error?.localizedDescription)")
}
}
我的范围:
let SCOPES = ["openid", "profile","User.Read","Contacts.Read"]
答案 0 :(得分:1)
Table A
---------------------------
| Id | User_id |Vehicle_id|
---------------------------
| 1 | 1 | 2 |
| 2 | 1 | 3 |
| 3 | 1 | 4 |
| 4 | 2 | 2 |
| 5 | 2 | 3 |
| 6 | 4 | 5 |
---------------------------
Table B
-------------------
| Id |Vehicle_name|
-------------------
| 1 | Car |
| 2 | Bike |
| 3 | Plane |
| 4 | Boat |
| 5 | Rocket |
-------------------
端点要求/contacts
具有可访问的Exchange邮箱。如果用户没有在Exchange Online中为此租户配置邮箱,则依赖于Exchange的多个端点将失败(user
,/contacts
,/events
等。