gpt4 book ai didi

java - 谷歌日历(共享)

转载 作者:行者123 更新时间:2023-12-04 17:55:08 32 4
gpt4 key购买 nike

我正在使用 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)

最佳答案

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

关于java - 谷歌日历(共享),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2220500/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com