【发布时间】:2021-10-24 13:53:36
【问题描述】:
我正在使用以下 Graph API URL 来检索附加到电子邮件的文件名:
https://graph.microsoft.com/v1.0/me/messages/*/attachments
但是,它不再返回“.msg”文件的附加文件名。缺少文件扩展名。请看下面的示例返回:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('')/messages('')/attachments",
"value": [
{
"@odata.type": "#microsoft.graph.itemAttachment",
"id": "*",
"lastModifiedDateTime": "2021-08-13T11:21:29Z",
"name": "Original Email",
"contentType": null,
"size": 45795,
"isInline": false
}
]
}
其他文件类型的情况:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('')/messages('')/attachments",
"value": [
{
"@odata.type": "#microsoft.graph.fileAttachment",
"@odata.mediaContentType": "application/octet-stream",
"id": "",
"lastModifiedDateTime": "2021-08-13T11:14:07Z",
"name": "Original Email.mht",
"contentType": "application/octet-stream",
"size": 54693,
"isInline": false,
"contentId": null,
"contentLocation": null,
"contentBytes": ""
}
]
}
注意:敏感信息已被编辑 (*)。
我可以看到 @odata.type 的返回方式不同:
@odata.type": "#microsoft.graph.itemAttachment
@odata.type": "#microsoft.graph.fileAttachment
我不知道这是为什么,电子邮件以相同的方式附加。
在上述两种情况下,我使用 Outlook 给自己发送了一封电子邮件,将其保存到我的本地文件系统,创建了另一封电子邮件,附加了之前保存的文件,然后向自己发送了附有保存的电子邮件的新电子邮件。然后使用指定的 URL(以及许多其他变体)发出请求。
我查看了所有内容,我使用的请求 URL 没有返回此类型的文件扩展名。
有没有办法返回“.msg”文件的文件名?
【问题讨论】:
标签: microsoft-graph-api microsoft-graph-mail