使用图谱API删除群组对话时出现问题

问题描述

针对组图API调用http delete方法时,出现以下错误消息:

{'error': {'code': 'ErrorInvalidOperation','message': "ConversationId isn't supported in the context of this operation.",'innerError': {'date': '2020-10-06T13:29:04','request-id': '{REQUEST-ID}','client-request-id': '{CLIENT-REQUEST-ID}'}}}

我正在使用委派权限和工作帐户,因为API不支持应用程序权限和MSA,并且调用具有相同URI的get方法将返回成功。

呼叫导致错误

    for conversation in collection_to_delete:
        test = requests.delete(
            config["endpoint"] + "/" + config["group_id"] + "/conversations/" + conversation,headers={'Authorization': 'Bearer ' + result['access_token']},).json()
        print(test)

可以找到完整的代码https://github.com/swes1110/CleanO365Conversations

知道我在做什么错吗?

解决方法

如果您需要调用Delete conversation MS graph api,则需要满足以下两个要求:

  1. 您必须使用工作或学校帐户,而不是个人Microsoft帐户。

  2. 您必须使用委派权限。

Here是与您类似的问题,供您参考。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...