Outlook - 阅读其他用户的日历

Outlook - Read another user's calendar

我正在开发一个 Android 应用程序,基于 Outlook-SDK-Android. The App talks with Outlook Calendar REST API to retrieve, book and delete events (see code examples and ). Now I need to read someone else's calendar and I've been provided an Office365 account with delegate access (author permission level) 面向其他用户。

我已经使用 new portal. In my App I use the scope "https://outlook.office.com/Calendars.ReadWrite 上提供的帐户注册了我的应用程序”。 (作用域在com.microsoft.aad.adal.AuthenticationContext.acquireToken()中用来初始化一个Office REST Client for Android OutlookClient, a shared client stack provided by orc-for-android

当我尝试读取另一个我具有委托访问权限的用户的日历时,我只收到了 403 响应:

{
  "error": {
    "code": "ErrorAccessDenied",
    "message": "Access is denied. Check credentials and try again."
  }
}

有什么帮助吗?

是API的限制吗?如果是,为什么会提供下面的方法调用链?

outlookClient.getUsers()
             .getById("meetingRoom@company.com")
             .getCalendarView()

更新:

似乎有 正在进行的工作 将允许这种情况,如此处报道:

所以如果在那个方向上取得了进展,我可以实现我的目标 而不使用“admin service app"? (see )

我可以按照建议使用基本身份验证吗here

日历委派是 Exchange 的一项功能,Graph API 和 Outlook API 不允许用户访问委派的日历。 目前,替代解决方法是使用 EWS。这里有一个示例供您参考:

static void DelegateAccessSearchWithFilter(ExchangeService service, SearchFilter filter)
{
    // Limit the result set to 10 items.
    ItemView view = new ItemView(10);

    view.PropertySet = new PropertySet(ItemSchema.Subject,
                                       ItemSchema.DateTimeReceived,
                                       EmailMessageSchema.IsRead);

    // Item searches do not support deep traversal.
    view.Traversal = ItemTraversal.Shallow;

    // Define the sort order.
    view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);

    try
    {
        // Call FindItems to find matching calendar items. 
        // The FindItems parameters must denote the mailbox owner,
        // mailbox, and Calendar folder.
        // This method call results in a FindItem call to EWS.
        FindItemsResults<Item> results = service.FindItems(
        new FolderId(WellKnownFolderName.Calendar,
            "fx@msdnofficedev.onmicrosoft.com"),
            filter,
            view);

        foreach (Item item in results.Items)
        {
            Console.WriteLine("Subject: {0}", item.Subject);
            Console.WriteLine("Id: {0}", item.Id.ToString());
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine("Exception while enumerating results: { 0}", ex.Message);
    }
}

private static void GetDeligateCalendar(string mailAddress, string password)
{
    ExchangeService service = new ExchangeService();

    service.Credentials = new WebCredentials(mailAddress, password);

    service.TraceEnabled = true;
    service.TraceFlags = TraceFlags.All;

    service.AutodiscoverUrl(mailAddress, RedirectionUrlValidationCallback);

    SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(AppointmentSchema.Subject, "Discuss the Calendar REST API"));
    DelegateAccessSearchWithFilter(service, sf);
}

如果您希望 Outlook 和 Graph API 支持此功能,您可以尝试通过以下 link 联系 Office 开发团队:

https://officespdev.uservoice.com/

FindMeetingTimes 目前处于预览阶段!要查看详细信息,请使用此 link 然后更改它以查看文章的 Beta 版本(主栏右上角):https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#Findmeetingtimespreview

文章中的详细信息如下,但请使用link获取最新的:

查找会议时间(预览)

根据组织者和与会者的可用性以及时间或地点限制查找会议时间建议。

此操作目前处于预览阶段,仅在测试版中可用。

所有支持的方案都使用 FindMeetingTimes 操作。 FindMeetingTimes 接受在请求正文中指定为参数的约束,并检查组织者和与会者主日历中的 free/busy 状态。响应包括会议时间建议,每个建议都定义为 MeetingTimeCandidate,与会者平均有 50% 或更高的机会参加会议。