Pablo
Pablo

Reputation: 105

Google Calendar API - Import event: Owner must be organizer or attendee

I'm using Google Calendar API for one of my projects.

I want to import events to Google Calendar from my app, and lock them so the final user won't be able to modify them in Google Calendar.

The API works great so far, however, when I try to import an event, I get this error:

The owner of the calendar must either be the organizer or an attendee of an event that is imported.

Even if I set the organizer to be one of the calendar's owners.

Here is the POST sample from the API console:

POST https://www.googleapis.com/calendar/v3/calendars/_my_calendar_id%40group.calendar.google.com/events/import?key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.AHES6ZTdiWGywGp2LLSUlc8BV-dVIwJET5azIkNekjNgRjHRWc_Ojg
X-JavaScript-User-Agent:  Google APIs Explorer

{
 "end": {
  "dateTime": "2013-01-02T16:22:00+00:00"
 },
 "iCalUID": "123456789",
 "start": {
  "dateTime": "2013-01-02T14:22:00+00:00"
 },
 "organizer": {
  "email": "[email protected]",
  "displayName": "Owner Guy"
 },
 "attendees": [
  {
   "email": "[email protected]"
  }
 ]
}

Steps to reproduce:

Upvotes: 3

Views: 3575

Answers (2)

grampush
grampush

Reputation: 31

On the error message:

The owner of the calendar must either be the organizer or an attendee of an event that is imported.

IMHO, The owner really means NOT the Google user, but the Email-like Calendar ID you're working on. This explains why some cases work only with the primary calendar, because the primary calendars have the same id with its owner user([email protected]).

So, you may try these:

  1. Do not set any organizer-related fields. Then Google sets appropriate values for the fields(either attendees[].organizer or organizer).
  2. Set the calendar ID as an attendee[].email

Upvotes: 3

Jas
Jas

Reputation: 337

From my experiments (I am not aware that this is documented anywhere), you can only 'import' events with attendees to the "primary" calendar in an account (not a sub-calendar). I do not know why this is. Also be aware that 'import' makes a private copy of the event and changes to the event will not be propagated to other attendees (though possibly attendee status will be).

Upvotes: 2

Related Questions