使用OutlookClient

时间:2016-02-23 18:17:34

标签: android ms-office outlook-calendar

我使用Outlook-SDK-Android(https://github.com/OfficeDev/Outlook-SDK-Android)与Outlook Calendar REST API(https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations)交谈。

到目前为止,我已经能够使用以下方式在我自己的日历上获取活动:

            import com.microsoft.services.outlook.fetchers.OutlookClient;

            OutlookClient mClient;
            ...
            mClient = new OutlookClient(outlookBaseUrl, mResolver);
            ...
            mClient.getMe()                
                    .getCalendarView()
                    .addParameter("startDateTime", startDate)
                    .addParameter("endDateTime", endDate)
                    .read()

这对应于" https://outlook.office.com/api/v2.0/me/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}"

  • 为了将其用于我已阅读权限的其他用户日历,如何以Outlook文档中指定的以下格式实现相同的目标?

" https://outlook.office.com/api/v2.0/USERS/meetingRoom@etc.com/calendars/Calendar/EVENTS?startDateTime={start_datetime}&endDateTime={end_datetime}"

(或者" ..v2.0/USERS/meetingRoom@etc.com/CALENDARVIEW

  • 如何添加查询参数" $ select"到后者,使用OutlookClient? (例如,$ select =主题,组织者,开始,结束)

2 个答案:

答案 0 :(得分:1)

select方法:

public OrcCollectionFetcher<TEntity, TFetcher, TOperations> select(String select)

OrcCollectionFetcher类中的

,所以你可以像这样调用它:

mClient.getMe()                
                    .getCalendarView()
                    .addParameter("startDateTime", startDate)
                    .addParameter("endDateTime", endDate)
                    .select("Subject")
                    .read()

要从资源中获取事件,请尝试以下操作:

            final List<Event> events = outlookClient
                .getUsers()
                .getById("meetingRoom@company.com")
                .getCalendarView()
                .addParameter("startDateTime", startDate)
                .addParameter("endDateTime", endDate)
                .read()

答案 1 :(得分:0)

        mClient.getMe()                
                .getCalendarView()
                .addParameter("startDateTime", startDate)
                .addParameter("endDateTime", endDate)
                .select("Subject,Start,End").
                .read()

请参阅https://msdn.microsoft.com/office/office365/api/complex-types-for-mail-contacts-calendar#UseODataqueryparametersSelectspecificpropertiestobereturned