Gcal api抛出错误

发布于 2024-08-04 04:13:04 字数 949 浏览 10 评论 0原文

我正在使用 zendgdata 库作为谷歌日历。

我在使用此函数 createQuickAddEvent(它将事件添加到谷歌日历)时收到此错误。

这个函数的代码是:

/**
 * Creates an event on the authenticated user's default calendar using 
 * the specified QuickAdd string.
 *
 * @param Zend_Http_Client $client The authenticated client object
 * @param string $quickAddText The QuickAdd text for the event
 * @return string The ID URL for the event
 */
function createQuickAddEvent ($client, $quickAddText) {
    $gdataCal = new Zend_Gdata_Calendar($client);
    $event = $gdataCal->newEventEntry();
    $event->content = $gdataCal->newContent($quickAddText);
    $event->quickAdd = $gdataCal->newQuickAdd(true);

    $newEvent = $gdataCal->insertEvent($event);
    return $newEvent->id->text;
    }

错误:预期响应代码200,得到403

可能是因为我没有加载谷歌日历(当您点击谷歌日历时第一次设置时区)。加载谷歌日历后,这个错误永远不会出现。但我想要一个解决方案。新用户永远不应该发生这种情况。

请帮助我

谢谢。

I am using zendgdata library for google calendar.

I am getting this error while using this function createQuickAddEvent(it add events to the the google calendar).

Code of this function is:

/**
 * Creates an event on the authenticated user's default calendar using 
 * the specified QuickAdd string.
 *
 * @param Zend_Http_Client $client The authenticated client object
 * @param string $quickAddText The QuickAdd text for the event
 * @return string The ID URL for the event
 */
function createQuickAddEvent ($client, $quickAddText) {
    $gdataCal = new Zend_Gdata_Calendar($client);
    $event = $gdataCal->newEventEntry();
    $event->content = $gdataCal->newContent($quickAddText);
    $event->quickAdd = $gdataCal->newQuickAdd(true);

    $newEvent = $gdataCal->insertEvent($event);
    return $newEvent->id->text;
    }

Error: Expected response code 200, got 403

May be this is due to the fact i have not loaded google calendar(setting timezone first time when you click google calendar). After loading google calendar this error never comes.But i want a solution to this.This thing should never happen with a new user.

Please help me

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残疾 2024-08-11 04:13:04

编辑:好吧,我想我完全误解了你。

您的意思是您想要将事件添加到日历中,但日历还不存在?不,你不能那样做。用户必须先注册 Google 日历,然后您才能尝试使用它。

除此之外,创建日历需要用户同意服务条款和隐私政策。虽然我们可能有某种方法来自动化所有这些 - 可能是针对经过验证的合作伙伴,我们会检查应用程序是否请求相同的同意 - 我非常怀疑它是否可以通过 Gdata 获得。

EDIT: Okay, I think I'd completely misunderstood you.

Do you mean you want to add an event to a calendar but the calendar doesn't even exist yet? No, you can't do that. The user will have to sign up to Google Calendar before you can try to use it.

Apart from anything else, creating a calendar involves the user agreeing to terms of service and a privacy policy. While we may have some way of automating all that - probably for validated partners, where we'd check that the application asked for the same consent - I highly doubt that it's available through Gdata.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文