我修改了sample_flask.py,在graphcall函数中添加了一个新的操作。新的MSGRAPH.post调用应该为用户创建一个openTypeExtension。代码如下:
endpoint = 'me/extensions'
data = {
"@odata.type": "microsoft.graph.openTypeExtension",
"extensionName": "com.myorgname.appname",
"permissions": "guest"
}
graphanswer = MSGRAPH.post(endpoint, headers=headers, data=data).data
print(graphanswer)
完整的端点路径是https://graph.microsoft.com/v1.0/me/extensions
,我也尝试使用绝对uid路径。报头从源代码中的get示例中回收。无论哪种情况,都会导致以下错误:
{'error':
{'code': 'RequestBroker--ParseUri',
'message': "Resource not found for the segment 'extensions'.",
'innerError':
{'request-id': '<omitted>', 'date': '2019-11-20T23:37:40'}
}
}
我已经在jwt.ms中检查了必要的作用域,并将其提升为User.ReadWrite.All并授予了权限。当我在Graph Explorer中测试post方法时,一切都很顺利,并且创建了扩展。
这里有明显的错误吗?我一直在通读与“资源未找到”错误和openTypeExtension相关的所有内容,但到目前为止还没有找到任何相关的东西。
发布于 2019-11-22 18:51:25
一切看起来都是正确的(Uri、http方法、场景、令牌等)但是我认为您请求中的content-type头是application/x-www-form-urlencoded
而不是application/json
。
https://stackoverflow.com/questions/58985645
复制相似问题