Google日历(分享)

时间:2010-02-08 09:11:34

标签: java google-calendar-api

我正在使用Google Apps应用程序。实际上,我想访问另一个id而不使用密码。我使用了OAuth并且运行良好。但我无法分享特定人的日历。我尝试了以下代码。

GoogleOAuthParameters oauthParam=new GoogleOAuthParameters();
oauthParam.setOAuthConsumerKey("xxxx.com");
oauthParam.setOAuthConsumerSecret("xxxxxxxxxxxxxxxxxxx");
oauthParam.setScope("http://www.google.com/calendar/feeds/");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/owncalendars  full?xoauth_requestor_id=user@example.com");
CalendarService service=new CalendarService("calendar");
service.setOAuthCredentials(oauthParam,new OAuthHmacSha1Signer());
AclEntry entry = new AclEntry();
entry.setScope(new AclScope(AclScope.Type.USER,"any.user"));
entry.setRole(CalendarAclRole.READ);
AclEntry insertedEntry = service.insert(feedUrl, entry);

对于此代码,我收到错误:

com.google.gdata.util.InvalidEntryException: Bad Request
Calendar entry does not contain title
    at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:558)
    at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)

1 个答案:

答案 0 :(得分:0)

将ACL条目而不是日历条目插入到自己的日历Feed中并不是一个好主意。此外,此API现已弃用,请使用http://code.google.com/apis/calendar/v3/getting_started.html作为参考。