我尝试使用Microsoft Graph API在共享邮箱中创建和阅读联系人。到目前为止,我设法创建了一个类似于以下扩展名的联系人:
POST https://graph.microsoft.com/beta/users/<SMB-ID>/contacts
"extensions":[
{
"@odata.type": "#Microsoft.Graph.OpenTypeExtension",
"extensionName": "specialdata",
"key1": "yes"
}]
Response:
{
...
"extensions": [
{
"@odata.type": "#microsoft.graph.openTypeExtension",
"id": "Microsoft.OutlookServices.OpenTypeExtension.specialdata",
"key1": "yes"
}
]
}
我的问题是我可以在没有扩展名的情况下阅读该联系人,但不能通过GET阅读。 docs中描述的两种方式都不起作用。
GET https://graph.microsoft.com/beta/users/<SMB-ID>/contacts?$expand=extensions($filter=id eq 'specialdata')
Response:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "441d4fd6-52a5-460a-a972-cddcd87222ee",
"date": "2017-02-08T14:40:48"
}
}
}
我的Bearer Token的范围如下:
"scp":
"
Calendars.Read.Shared
Calendars.ReadWrite.Shared
Contacts.Read.Shared
Contacts.ReadWrite.Shared
full_access_as_user
Mail.Read.Shared
Mail.ReadWrite.Shared
Mail.Send.Shared
User.Read"
我是否在Graph,共享邮箱中丢失了权限,或者它是不受支持的功能?
答案 0 :(得分:1)
您的GET网址看起来有误。从那以后,您尝试列出用户实体下的所有内容。由于这是联系人,请尝试:
GET https://graph.microsoft.com/beta/users/<SMB-ID>/contacts?$expand=extensions($filter=id eq 'specialdata')