"What am I doing wrong?"

Currently you are querying your allcalendars feed url 2x and printing
the titles of the entries of that feed. As you see, those don't change
from query to query. (Although it is something of a surprise that
Google accepts the maximum and minimum start time parameters on the
second query.)

You need to get the url of a particular calendar and query that url.


Specifically this line of your code:

CalendarQuery myQuery = new CalendarQuery(feedUrl);

should be replace by something like this:

calendarUrl = new
URL("http://www.google.com/calendar/feeds/pstesty%40gmail.com/private/full";);
CalendarQuery myQuery = new CalendarQuery(calendarUrl);

which would work for your primary calendar, or you could determine the
value of calendarUrl on the basis of some logic in the previous loop
over the resultFeed.entries.


Ray







On Sun, Oct 12, 2008 at 1:31 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Here's my code:
>
> import com.google.gdata.client.*;
> import com.google.gdata.client.calendar.*;
> import com.google.gdata.data.*;
> import com.google.gdata.data.acl.*;
> import com.google.gdata.data.calendar.*;
> import com.google.gdata.data.extensions.*;
> import com.google.gdata.util.*;
>
> import java.io.IOException;
> import java.net.MalformedURLException;
> import java.net.URL;
> import java.util.Iterator;
> import java.util.List;
>
> public class CalendarTest {
>    public static void main(String[] args) {
>
>        CalendarService myService = new CalendarService("Test Data
> Extraction");
>        try {
>                myService.setUserCredentials("[EMAIL PROTECTED]",
> "notmyrealpassword");
>        } catch (AuthenticationException e) {
>                e.printStackTrace();
>        }
>        URL feedUrl;
>        CalendarFeed resultFeed;
>                try {
>                        feedUrl = new URL("http://www.google.com/calendar/
> feeds/calendar/allcalendars/full");
>                        resultFeed = myService.getFeed(feedUrl, 
> CalendarFeed.class);
>                       System.out.println("My 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());
>                       }
>
>                       CalendarQuery myQuery = new CalendarQuery(feedUrl);
>
> myQuery.setMinimumStartTime(DateTime.parseDateTime("2008-10-12T00:00:00"));
>
> myQuery.setMaximumStartTime(DateTime.parseDateTime("2008-10-12T23:59:59"));
>                       CalendarEventFeed erf = myService.query(myQuery,
> CalendarEventFeed.class);
>
>                       System.out.println();
>                       System.out.println("My events for the day:");
>                       System.out.println();
>
>                       List<CalendarEventEntry> l = erf.getEntries();
>                       Iterator<CalendarEventEntry> li = l.iterator();
>                       while (li.hasNext()) {
>                           CalendarEventEntry cee = li.next();
>                           System.out.println("\t" +
> cee.getTitle().getPlainText() );
>                       }
>                } catch (MalformedURLException e) {
>                        e.printStackTrace();
>                } catch (IOException e) {
>                        e.printStackTrace();
>                } catch (ServiceException e) {
>                        e.printStackTrace();
>                }
>    }
> }
>
>
> And here is the output that I receive:
>
> My calendars:
>
>        [EMAIL PROTECTED]
>        B and B Brady Travel Parties!!
>        Events & Parties
>        Rascal's Parties
>
> My events for the day:
>
>       [EMAIL PROTECTED]
>       B and B Brady Travel Parties!!
>       Events & Parties
>       Rascal's Parties
>
> What am I doing wrong? Or am I supposed to do aomething else to
> retrieve all the events that are supposed to occur in my calendar
> today?
>
> Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to