Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:12:33+00:00 2026-05-28T05:12:33+00:00

Using the Google Calendar Api . After browsing the rfc2445 , I’m still unable

  • 0

Using the Google Calendar Api.

After browsing the rfc2445, I’m still unable to set recurrence on an event.

private String[] days = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"}; 
private String rrule = "RRULE:FREQ=WEEKLY;WKST=MO;BYDAY=";
private Event createdEvent;
...

Event event = new Event();
StringBuilder sb = new StringBuilder();
sb.append(rrule);
sb.append(days[startTime.get(java.util.Calendar.DAY_OF_WEEK)-1]);
event.setSummary("HELLO WORLD");
event.setLocation("");

DateTime start = new DateTime(startTime.getTime(), TimeZone.getTimeZone("UTC"));
event.setStart(new EventDateTime().setDateTime(start));
DateTime end = new DateTime(endTime.getTime(), TimeZone.getTimeZone("UTC"));
event.setEnd(new EventDateTime().setDateTime(end)); 

//Setting Recurrence
ArrayList<String> recur = new ArrayList<String>();
recur.add(sb.toString());
event.setRecurrence(recur);

createdEvent = cal.events().insert("primary", event).execute();  //line 167

After running the above code, I keep receiving this error (NB: everything works if I omit specifying the recurrence, though obviously this makes the event single-occurring):

01-13 19:26:17.190: WARN/System.err(5732): com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
01-13 19:26:17.190: WARN/System.err(5732): {
01-13 19:26:17.190: WARN/System.err(5732):   "code" : 400,
01-13 19:26:17.190: WARN/System.err(5732):   "errors" : [ {
01-13 19:26:17.190: WARN/System.err(5732):     "domain" : "global",
01-13 19:26:17.190: WARN/System.err(5732):     "message" : "Required",
01-13 19:26:17.190: WARN/System.err(5732):     "reason" : "required"
01-13 19:26:17.190: WARN/System.err(5732):   } ],
01-13 19:26:17.190: WARN/System.err(5732):   "message" : "Required"
01-13 19:26:17.190: WARN/System.err(5732): }
01-13 19:26:17.190: WARN/System.err(5732):     at com.google.api.client.googleapis.services.GoogleClient.execute(GoogleClient.java:123)
01-13 19:26:17.190: WARN/System.err(5732):     at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:67)
01-13 19:26:17.190: WARN/System.err(5732):     at com.google.api.services.calendar.Calendar$Events$Insert.execute(Calendar.java:2308)
01-13 19:26:17.190: WARN/System.err(5732):     at com.example.myproject.className.run(className.java:167)
01-13 19:26:17.190: WARN/System.err(5732):     at java.lang.Thread.run(Thread.java:1020)

I manually created a recurring event in the Calendar, and made a simple method to read it in. When performing event.getRecurrence. The recurrence was "RRULE:FREQ=WEEKLY;WKST=MO;BYDAY=MO", which accurately stated that the event that I had created is weekly recurring on a Monday.

Can anybody spot where I’m going wrong?

EDIT:

Using Google’s Api Explorer, I manually created the JSON with the recurrence field and it worked.

After Logging the JSON being created from event, it seems that the timezone isn’t being passed.

{end={dateTime=2012-01-16T09:50:00.000Z}, location=, recurrence=[RRULE:FREQ=WEEKLY;], start={dateTime=2012-01-16T09:00:00.000Z}, summary=HELLO WORLD}

Additionally, performing event.getStart().getTimeZone().toString() caused java.lang.NullPointerException.

Not sure why they aren’t being passed …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:12:33+00:00Added an answer on May 28, 2026 at 5:12 am

    It seems that one must add the TimeZone again when creating an EventDateTime from the DateTime object. The following worked:

    DateTime start = new DateTime(startTime.getTime(), TimeZone.getTimeZone("UTC"));
    event.setStart(new EventDateTime().setDateTime(start).setTimeZone("UTC");
    DateTime end = new DateTime(endTime.getTime(), TimeZone.getTimeZone("UTC"));
    event.setEnd(new EventDateTime().setDateTime(end).setTimeZone("UTC");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the exact examples from the Google Calendar API in C#: string
I am using google calendar api to export an event to google calendar, when
I want to make Task in Google Calendar using Google Calendar API : c#.
I want to create Task in Google Calendar using Google Calendar API.Using C#. Looking
I am using Google API Version 2 fo .NET to create Google Calendar Entries.
I am using Google API Version 2 fo .NET to create Google Calendar Entries.
I'm using the new Google Calendar API v3. I'm trying to obtain the users
Actually I need to create an event in Google Calendar using my app. Every
I'm trying to get a session token to use the Google Calendar API using
I'm developing an Android APP that connects to Google Calendar using GData API for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.