0

我在 Google 日历中有 2 个或更多日历。我可以将事件添加到该特定日历,例如:

[...]
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$service = new Zend_Gdata_Calendar($client);

//Set up  that loop again to find the new calendar:
$calFeed = $service->getCalendarListFeed();
foreach ($calFeed as $calendar) {
    if($calendar->title->text == "Calendar2")
         $appCalUrl = $calendar->content->src;
    }
}
[...]

try {

    $event           = $service->newEventEntry();
    $event->title    = $service->newTitle($title);

    $when            = $service->newWhen();
    $when->startTime = $start;
    $when->endTime   = $end;

    $event->when     = array($when);
    $newEvent        = $service->insertEvent($event, $appCalUrl);

    // fetch URI for edit, delete
    $uri = $newEvent->id->text;

} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getResponse();
}

$uri 会生成如下字符串: http ://www.google.com/calendar/feeds/7b06drcai3lhc4lhhb0lgvv7sk%40group.calendar.google.com/private/full/ndp7g62tbbvknhi8bbhh9jfu9o

然后,使用:

try {

     $title = "test2";
     $event = $service->getCalendarEventEntry($uri);
     $event->title = $service->newTitle($title);
    } catch (Zend_Gdata_App_Exception $e) {
    die("Error: " . $e->getResponse());
} 

这总是会导致错误,例如:BAD / Invalid URI

我一直在搜索,并且在多个示例中都说 URI 格式应该类似于:

getCalendarEventEntry('http://www.google.com/calendar/feeds/default/private/full/' . $id);

仅获取 ID 也不起作用。有任何想法吗?

4

1 回答 1

0

找到遮阳篷:

字符串的格式是:

http://www.google.com/calendar/feeds/$calendar_id%40group.calendar.google.com/private/full/$event_id
于 2012-11-05T17:52:07.007 回答