使用Microsoft图形API,我可以获得每条MS Teams消息的webhook通知。收到以下格式的带有文件附件的邮件时:
"attachments": [
{
"id": "aa567f71-4702-4b43-b756-2f453ddb662a",
"contentType": "reference",
"contentUrl": "... the url",
"content": null,
"name": "my file.xlsm",
"thumbnailUrl": null
}
],然后,我尝试调用图形API来检索文件信息,并使用上面的id (https://graph.microsoft.com/v1.0/groups/" + teamId +“/https://graph.microsoft.com/v1.0/groups/"/items/”+ id)对其执行操作(特别是删除),但得到一个错误(资源找不到)。我猜我在附件中获取的ID不是文件项id。有没有方法可以使用图形API从附件ID中获取项ID?
发布于 2020-08-18 02:40:11
我们在附件响应中收到的ID实际上是etag id,除了直接下载内容之外,我们根本不能使用它。
检索文件元数据信息可能有两种方法。
/groups/<team-id>/drive/root/delta?search(q='<attachment-name>')上面的查询是不可靠的,根据MS索引它的速度,它可能需要2-5分钟的时间。
示例:/teams/<team-id>/channels/<channel-id>/filesFolder?$select=id <--获取频道的文件夹id。
使用上面的id,我们可以做foll。/groups/<team-id>/drive/item/folder-id/children?filter=name eq 'attachment_name'
https://stackoverflow.com/questions/63114048
复制相似问题