【问题标题】:How to grab tasks from Google Tasks API for Google Apps Domains?如何从 Google Apps Domains 的 Google Tasks API 中获取任务?
【发布时间】:2011-06-21 10:59:09
【问题描述】:

我编写了以下代码,可与 Google Tasks API 一起使用,但它仅在来自 gmail.com 时才显示结果。它不适用于任何自定义 Google Apps 域。有人知道我应该为 Google Apps Domain Tasks API 使用的网址吗?

代码:

<?php
session_start();

//load libs
require_once "include/google-api-php-client/src/apiClient.php";
require_once "include/google-api-php-client/src/contrib/apiTasksService.php";

//load api
$apiClient = new apiClient();
$service = new apiTasksService($apiClient);

//authenticate
if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

//get token
//echo "token: ".$_SESSION['oauth_access_token']."<br />";

//get list
$taskLists = $service->listTasklists();

foreach ($taskLists['items'] as $taskList) {
  echo $taskList['title'] . " - " . $taskList['id'] . "<br />";
}


//get list items
echo "<ul>";
$tasks = $service->listTasks('@default');

foreach($tasks['items'] as $task) {
    $title = $task['title'];
    echo "<li>$title</li>";
}
echo "</ul>&#9644;&#9644;&#9644;";



?>

【问题讨论】:

    标签: google-api gdata-api google-apps gdata


    【解决方案1】:
    【解决方案2】:

    我正在使用 gafyd,它对我有用。您的域是否已迁移到新系统?

    【讨论】:

      猜你喜欢
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-18
      • 1970-01-01
      • 2012-10-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多