简体   繁体   中英

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. Right now my programm only returns the Events of a Calendar by its CalendarID. I've used the Code of the Google Developers Site (Calendar API V3). After the authorization process is over, the code creates a new object named "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
  • Iterate the current list looking for matches.
  • If matched, add the element to the new list.

And as an aside, this is 'programming 101'. You should probably steer clear of web API's until you have the basics of the language and coding sorted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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