【问题标题】:Is there a way to get events from all users calendars (default and others) in one call in office 365 API.有没有一种方法可以在 Office 365 API 的一次调用中从所有用户日历(默认和其他)中获取事件。
【发布时间】:2015-09-16 15:40:05
【问题描述】:

在 Office 365 API 中,我没有找到任何单一服务可以在一次调用中返回用户日历中的所有事件。 如果用户有 3 个日历,则需要通过日历 ID 进行三个调用。

首先需要通过调用获取日历ID

https://outlook.office.com/api/v1.0/me/calendars

那么对于每个Calendar Id,需要通过调用来获取事件

GET https://outlook.office.com/api/{version}/me/calendars/{calendar_id}/calendarview?startDateTime={start_datetime}&endDateTime={end_datetime}

如果有任何单次通话,则将减少往返次数。

感谢您的帮助。

【问题讨论】:

    标签: office365 office365api


    【解决方案1】:

    不,没有一个调用可以获取所有日历的“合并”视图。这是一个有趣的想法,我认为您应该将其发布到UserVoice

    【讨论】:

    • 好的,再次感谢 Jason 的快速回答。欣赏它。
    【解决方案2】:

    确实,我们不能一次点击多个日历,但是我们可以使用并行 foreach 进行同时调用以获得更快的响应。

    Task[] CalendarListEvents = new Task[CalendarList.Count];
    Parallel.ForEach(CalendarList, (Calendar) =>
    { 
        tasksToFetchDailyEvents[index] = Task.Factory.StartNew(() =>
        {               
                  // Code to fetch Events and add to list
        });
    
    });
    Task.WaitAll(CalendarListEvents);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-09
      • 2014-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多