Hi,
This is a sample snippet to iterate through all events and list out
its title, description and participant's email:
public void getAllEvent() throws Exception {
// Set up the URL and the object that will handle the connection:
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/
private/full");
// Send the request and receive the response:
CalendarEventFeed resultFeed = myService.getFeed(feedUrl,
CalendarEventFeed.class);
System.out.println("Totle results: " + resultFeed.getTotalResults());
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEventEntry entry = resultFeed.getEntries().get(i);
String title = entry.getTitle().getPlainText();
System.out.println("Title: " + title);
String description = ((TextContent)
entry.getContent()).getContent().getPlainText();
System.out.println("Description: " + description);
List<EventWho> participants = entry.getParticipants();
Iterator iter = authors.iterator();
while (iter.hasNext()) {
EventWho who = (EventWho) iter.next();
String email = who.getEmail();
System.out.println("Particpant email: " + email);
}
}
}
Hope it helps,
Austin
On Nov 28, 4:40 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to scan my google calendar for each event. I want to get
> the Title, time, location, description and participants in each event.
> I cannot get the location(Except as part of the getSummary method) or
> the participants.
>
> Everything I try results in locations and participants returning empty
> lists.
> The workarounds for the getParticipants is not working for me either.
>
> I also cannot get the description of the event using any of the
> methods in the API.
>
> Attached is my full code.
>
> Any help would be really appreciated!
>
> cheers,
>
> Steve
>
> public class gCalSensor {
> public static void main(String[] args) throws IOException,
> ServiceException {
> URL url = new URL("myurl");
> CalendarService my_calendar_service = new
> CalendarService("name_of_service");
> my_calendar_service.setUserCredentials(arg0, arg1);
>
> CalendarEventFeed feed = my_calendar_service.getFeed(url,
> CalendarEventFeed.class);
>
> List<CalendarEventEntry> l = feed.getEntries();
>
> for(int i=0; i<l.size(); i++){
> CalendarEventEntry entry = (CalendarEventEntry)
> l.get(i);
> String title = entry.getTitle().getPlainText();
> System.out.println("Title: \t" + title);
> System.out.println(entry.getStatus());
>
> List<Where> locations = entry.getLocations();
>
>
> System.out.println(entry.getContent().getClass().getName());
>
> List participants = entry.getParticipants();
> System.out.println("participants"+participants);
>
> List<EventWho> people =
> entry.getRepeatingExtension(EventWho.class);
>
> System.out.println("Num Participants:"+people.size());
> for (EventWho googleAttendee : people) {
> System.out.println(googleAttendee);
> }
>
> System.out.println("Locations" + locations);
>
> }
> }
>
> }
>
> Please provide any additional information below.
> There are documented workarounds for the getParticipants bug, but this
> does not work for me either.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---