/**
   * Retrieves all the calendar for the specified users
   *
   * @param userName User name of the account
   * @param password password for the account
   * @return All {@link List<CalendarEntry>} for the specified account
   * @throws Exception If an error occurs while retrieving the account
   */
  public static List<CalendarEntry> getAllCalendars(String userName, String password)
      throws Exception {
    CalendarService myService = new CalendarService("CalendarService-" + userName);
    myService.setUserCredentials(userName, password);

    // Send the request and print the response
    URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
    //        URL feedUrl = new URL("https://www.google.com/calendar/feeds/private/full");
    CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

    return resultFeed.getEntries();
  }
Beispiel #2
0
    public void accept(CalendarService service) throws IOException, ServiceException {
      final URL feedUrl =
          new URL("https://www.google.com/calendar/feeds/default/owncalendars/full");
      final CalendarFeed resultFeed = service.getFeed(feedUrl, CalendarFeed.class);

      System.out.println("Calendars you own:");
      System.out.println();
      for (int i = 0; i < resultFeed.getEntries().size(); i++) {
        final CalendarEntry entry = resultFeed.getEntries().get(i);
        System.out.println("\t" + entry.getTitle().getPlainText());
      }
    }
Beispiel #3
0
  public static void main(String[] args) throws IOException, ServiceException {
    CalendarService myService = new CalendarService("exampleCo-exampleApp-1.0");
    myService.setUserCredentials("*****@*****.**", "papa25031965");

    URL feedUrl =
        new URL(
            "http://www.google.com/calendar/feeds/dhrshh%40gmail.com/private-fa984c89cc7a1777baf3157ef212209f/basic");
    CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

    System.out.println("Your calendars:");
    System.out.println();

    for (int i = 0; i < resultFeed.getEntries().size(); i++) {
      CalendarEntry entry = resultFeed.getEntries().get(i);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }
  }