我的用例是我想创建一个从共享收件箱中读取消息的应用程序,然后可以为用户分配一条消息。为此,我为Messages添加了一个schemaExtension
POST https://graph.microsoft.com/v1.0/schemaExtensions
{
"id":"message_responsibility",
"description": "Sets a users email to a message to indicate a messages responsibility",
"targetTypes": [
"Message"
],
"owner": "<redacted>",
"properties": [
{
"name": "responsibility",
"type": "String"
},
]
}
创建schemaExtension后,我将其设置为可用:
PATCH https://graph.microsoft.com/v1.0/schemaExtensions/{id}
{
"status": "Available",
"owner": "<redacted>",
}
然后我尝试将责任添加到来自共享收件箱的现有邮件中:
POST https://graph.microsoft.com/v1.0/users('shared@inbox.com')/messages/<messageId>
{
"extr5f2qmdk_responsibility": {
"responsibility": "someone@inbox.com"
}
}
但是我得到的只是这个回应:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "73cc3cb2-37e4-4003-833b-b2348804c045",
"date": "2018-11-28T10:50:36"
}
}
}
即使试图在?$ select语句中包含该属性,也会使服务器返回错误500:
https://graph.microsoft.com/v1.0/users('shared@inbox.com')/messages?$select=extr5f2qmdk_responsibility
非常感谢您的帮助
答案 0 :(得分:0)
根据您的描述,我假设您要为消息资源创建一个schemaExtensions。
根据您发布的错误响应,您没有正确的权限。在this document中,权限应为Delegated (work or school account) Directory.AccessAsUser.All
。
第二,您已经创建了名称为responsibility
的schemaExtensions,但是,当您添加名称为extr5f2qmdk_responsibility
的模式扩展时