简体   繁体   English

使用Java中的API获取Google Calendar Event参与者

[英]Get Google Calendar Participants of Event with API in Java

I want to write a programm in Java, which is able to remove a Participant from a Google Calendar Event. 我想用Java编写一个程序,该程序可以从Google日历活动中删除参与者。 Right now my programm only returns the Events of a Calendar by its CalendarID. 现在,我的程序仅按其CalendarID返回日历的事件。 I've used the Code of the Google Developers Site (Calendar API V3). 我已经使用了Google Developers Site(Calendar API V3)的代码。 After the authorization process is over, the code creates a new object named "service" 授权过程结束后,代码将创建一个名为“ service”的新对象。

    Calendar service = new Calendar.Builder(httpTransport, jsonFactory,
            credential).build();

    getAllEvent(service);

With this 有了这个

  events = service.events().list("CalendarID")
                .setPageToken(pageToken).execute(); 
List<Event> items = events.getItems();

I get a list of all Events from my Calendar, but I want to get the Participants and then i want to delete a special participant from the event. 我从日历中获取所有事件的列表,但我想获取参与者,然后从事件中删除特殊参与者。 Could someone give me an easy Code-snippet or help? 有人可以给我简单的代码片段或帮助吗? I've tried 我试过了

 service.events().list("CalendarId").getParticipants or "getAttendees"

but there isn't a method like that. 但是没有这样的方法。

The basic approach would be to: 基本方法是:

  • Establish a new List then 然后建立一个新List
  • Iterate the current list looking for matches. 迭代当前列表以查找匹配项。
  • If matched, add the element to the new list. 如果匹配,则将元素添加到新列表中。

And as an aside, this is 'programming 101'. 顺便说一句,这是“编程101”。 You should probably steer clear of web API's until you have the basics of the language and coding sorted. 在掌握了语言和编码的基础知识之前,您可能应该避免使用Web API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM