Outlook Mail REST Api:如何仅获取内联附件?

时间:2016-08-25 10:18:36

标签: office365api office365-restapi

似乎无法弄清楚如何只从电子邮件中获取内联附件。 The docs说IsInline属性是可过滤的,但是当我发送此请求时,我会同时获得内联和非内联文件:

    public static function getInlineAttachments($access_token, $user_email, $message_id) {

    $attachmentsFilter = array(
        "\$select" => "Id,Name,ContentType,Size,IsInline,Microsoft.OutlookServices.FileAttachment/ContentId",
        "\$filter" => "IsInline eq true"
    );

    $url = "https://outlook.office.com/api/v2.0/Me/Messages/" . $message_id . '/attachments?' . http_build_query($attachmentsFilter);

    return self::makeApiCall($access_token, $user_email, "GET", $url);
}

还有另一种选择,只能获取有关附件的元数据,然后查询API以仅通过Id获取内联数据,但如果获得大量内联附件,则会超出GET请求最大长度,因此请求失败。在几个连续的请求中有另一个批处理附件的选项,但这也不理想。

那么,任何人都能很好地解决这个问题吗?

更新: 我似乎无法按附件ID或名称进行过滤。似乎即使是我认为我可以使用的变通方法也行不通。我一定错过了什么......

0 个答案:

没有答案