Get user calendar using OutlookClient

笑着哭i 提交于 2019-12-29 09:33:52

问题


I'm using 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).

So far I've been able to get the events on my own calendar using:

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

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

This corresponds to "https://outlook.office.com/api/v2.0/me/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}"

  • In order to use it for other users calendars on which I have read permission how do I achieve the same in the following format specified in the Outlook documentation?

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

(or also "..v2.0/USERS/meetingRoom@etc.com/CALENDARVIEW)

  • How do I add the query parameter "$select" to the latter, using OutlookClient? (eg. $select=Subject,Organizer,Start,End)

回答1:


There is a select method:

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

in OrcCollectionFetcher class, so you can call it like this:

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

To get events from resource try this:

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



回答2:


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

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



来源:https://stackoverflow.com/questions/35585155/get-user-calendar-using-outlookclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!