【问题标题】:Fetch Outlook calendar events between two dates获取两个日期之间的 Outlook 日历事件
【发布时间】:2018-04-26 16:49:54
【问题描述】:

我在 Laravel 中实现了 Outlook 日历 API。我正在获取所有日历事件。 但现在我想获取两个特定日期之间的日历事件,即按月。那么开始日期时间和结束日期时间的键是什么。因为在某些地方它被赋予 start_time,在某些地方 startDateTime 和一些使用 $filter。 下面是我的查询参数数组

$eventsQueryParams = array (
    // Only return Subject, Start, and End fields
    "\$select" => "subject,start,end",
    // Sort by Start, oldest first
    "\$orderby" => "Start/DateTime",
    // Return at most 10 results
    "\$top" => "10"
);

要使用过滤器,我尝试了下面的代码,但收到 400 Bad Request

"\$filter" => "start/dateTime ge ".date(DATE_ISO8601,strtotime('2018-04-01 00:00:00'))." and end/dateTime le ".date(DATE_ISO8601,strtotime('2018-04-30 00:00:00')),

现在我应该添加什么到我的 $eventsQueryParams 以便我可以按月获取日历事件。 谢谢。

【问题讨论】:

    标签: laravel outlook-calendar


    【解决方案1】:

    我尝试了以下代码,它对我有用。

    $eventsQueryParams = array (
        // Only return Subject, Start, and End fields
        "\$select" => "subject,start,end",
        // Sort by Start, oldest first
        "\$orderby" => "Start/DateTime",
        // Return at most 10 results
        "\$top" => "10",
        "\$filter" => "Start/DateTime ge '".date('Y-m-d',strtotime('2018-04-01 00:00:00'))."' and End/DateTime le '".date('Y-m-d',strtotime('2018-04-30 00:00:00'))."'",
    );
    

    最初缺少日期的引号。 在更改我的代码之前

    $eventsQueryParams = array (
        // Only return Subject, Start, and End fields
        "\$select" => "subject,start,end",
        // Sort by Start, oldest first
        "\$orderby" => "Start/DateTime",
        // Return at most 10 results
        "\$top" => "10",
        "\$filter" => "Start/DateTime ge ".date('Y-m-d',strtotime('2018-04-01 00:00:00'))." and End/DateTime le ".date('Y-m-d',strtotime('2018-04-30 00:00:00')),
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-11
      • 2020-05-10
      • 2016-06-30
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 2012-10-23
      相关资源
      最近更新 更多