2013-01-02 109 views
3

我正在使用Google Calendar API作为我的一个项目。Google Calendar API - 导入活动:所有者必须是组织者或与会者

我想从我的应用程序将事件导入到Google日历,并将其锁定,以便最终用户无法在Google日历中修改它们。

的API的伟大工程,到目前为止,但是,当我尝试进口事件,我得到这个错误:

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

即使我设定的组织者是日历的所有者之一。

下面是从API控制台POST样本:

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]" 
    } 
] 
} 

重现步骤:

  • 创建日历并获得ID或使用“主”您的主日历。
  • 与某人分享,或让某人成为拥有者。
  • 转到日历API参考/ events/import - >“试试吧!”,并在提交POST之前使用oAuth进行身份验证。
  • 填写必填字段(开始,结束,icaluid等)
  • 尝试将组织者或任何与会者设置为日历所有者之一。
+0

日历ID你解决这个问题?你现在能够导入事件吗? –

回答

2

从我的实验(我不知道这是在任何地方记录),只能将参加者的事件导入帐户(而不是子日历)中的“主要”日历。我不知道这是为什么。另外请注意,“导入”会生成事件的私人副本,并且对该事件的更改不会传播给其他与会者(尽管可能会出现与会者状态)。

3

上的错误消息:

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

恕我直言,The owner的真正含义不是在谷歌的用户,但电子邮件般的日历ID你的工作。这解释了为什么某些情况下只能使用primary日历,因为主日历与其所有者用户([email protected])具有相同的ID。

所以,你可以尝试这些:

  1. 不要设置任何组织相关领域。然后Google为这些字段设置适当的值(attendees[].organizerorganizer)。
  2. 设置为attendee[].email
相关问题