×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    1

    accessing Google calendar API, delete existing event

    I am trying to get code to work based on samples available at

    http://code.google.com/apis/calendar...ngWithoutQuery

    I would like to create a query to retrieve events between a date range and then
    delete each of those events.

    Below is a program fragment. The first loop works and prints out info
    on the events between the first of the year and two days ago.

    The second loop has a compiler error. I realize that an_event2 is not
    of the proper type. This is where I am stuck. I apologize for the sloppy code. I'm no python
    expert. I was trying to piece things together from the documentation
    samples. I only found samples where events to delete had been just
    added.

    query = gdata.calendar.service.CalendarEventQuery('default',
    'private', 'full')
    query.start_min = '2008-01-01'

    today = datetime.date.today()
    twodays = datetime.timedelta(days=2)
    twodaysago = today
    twodaysago -= twodays

    query.start_max = twodaysago.strftime('%Y-%m-%d')
    feed = calendar_service.CalendarQuery(query)
    for i, an_event in enumerate(feed.entry):
    print '\t%s. %s' % (i, an_event.title.text,)
    for a_when in an_event.when:
    print '\t\tStart time: %s' % (a_when.start_time,)
    print '\t\tEnd time: %s' % (a_when.end_time,)

    feed = calendar_service.CalendarQuery(query)
    for an_event2 in enumerate(feed.entry):
    calendar_service.DeleteEvent(an_event2.GetEditLink().href)

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: accessing Google calendar API, delete existing event

    Hi ndodge and welcome to the Python Discussion Board.

    Could you please put CODE tags around your code to keep it indented and make it more visible? Just use the "#" sign button when editing/replying.
    Last edited by bogdan.galiceanu; 2008-05-27 at 15:45.

Similar Threads

  1. PC Suite error: (Code: Init IMediaControl2) HELP?!
    By chunkyspudmonkey in forum General Development Questions
    Replies: 29
    Last Post: 2008-06-30, 11:47
  2. KErrDisconnected event in HTTP's API MHFRunL() after receiving SMS on device
    By eekisa in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-11-14, 07:39
  3. module adding alarm + delete entries to calendar
    By worlman385 in forum Symbian
    Replies: 0
    Last Post: 2007-02-03, 19:42
  4. delete event
    By TOOL in forum Symbian
    Replies: 2
    Last Post: 2005-11-25, 12:58
  5. Accessing Phonebook, Calendar, Messages, etc with Java
    By rjperes in forum Mobile Java General
    Replies: 1
    Last Post: 2005-10-04, 10:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×