使用 OutlookClient 获取用户日历

Get user calendar using OutlookClient

我正在使用 Outlook-SDK-Android (https://github.com/OfficeDev/Outlook-SDK-Android) to talk with 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}

"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方法:

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

OrcCollectionFetcherclass中,所以可以这样称呼:

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()
        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