Microsoft graph api- 过滤附加文件扩展名
Microsoft graph api- Filtering on attached file extensions
我正在使用 ms graph api 来获取所有带附件的消息。为此,我需要获取扩展名为 docx/pdf 的文件。以下是我试过的过滤器。
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true 和 ext eq 'docx'
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true 和扩展 eq 'docx'
您需要使用多个 API 调用来完成此操作。首先,您需要检索包含附件 (has Attachments
) 的 messages 列表,然后您需要迭代生成的 id
以检索附件元数据。
例如,调用 returns 包含附件的邮件 ID 列表:
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true&$select=id
对于我们返回的每个 ID,我们将进行第二次调用以获取附件:
https://graph.microsoft.com/v1.0/me/messages/{message id}/attachments
根据这些结果,您可以检查 Attachment's name
属性 以确定文件扩展名是什么。
我正在使用 ms graph api 来获取所有带附件的消息。为此,我需要获取扩展名为 docx/pdf 的文件。以下是我试过的过滤器。
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true 和 ext eq 'docx'
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true 和扩展 eq 'docx'
您需要使用多个 API 调用来完成此操作。首先,您需要检索包含附件 (has Attachments
) 的 messages 列表,然后您需要迭代生成的 id
以检索附件元数据。
例如,调用 returns 包含附件的邮件 ID 列表:
https://graph.microsoft.com/v1.0/me/messages?$filter=hasAttachments eq true&$select=id
对于我们返回的每个 ID,我们将进行第二次调用以获取附件:
https://graph.microsoft.com/v1.0/me/messages/{message id}/attachments
根据这些结果,您可以检查 Attachment's name
属性 以确定文件扩展名是什么。