1

使用 Groups PHP API 并尝试获取现有的组设置和成员。

感谢divideandconquer.se的帮助,我修改了我的代码:

function get_google_group($groupId) {
    $group = false;
    try {
        echo '<br />Getting Google Group: ' . $groupId . '<br />';
        $myClient = $this->getClient();
        $myClient->addScope( 'https://www.googleapis.com/auth/apps.groups.settings');
        $groupsettingsService = new Google_Service_Groupssettings($myClient);
        $group = $groupsettingsService->groups->get($groupId);

        echo 'SUCCESS: group=';

    } catch (exception $e) {
        echo '<br />*** EXCEPTION *** ' . $e->getMessage() . '<br />';
        return false;
    }

    return $group;
}

我仍然遇到异常:在调用“get”方法时:

Getting Google Group: 04k668n33tdjvkw

*** EXCEPTION *** Error calling GET https://www.googleapis.com/groups/v1/groups/04k668n33tdjvkw: (403) GData insufficientPermissions Insufficient Permission 
4

1 回答 1

1

不要Google_Service_Groupssettings_Groups_Resource直接使用。使用Google_Service_Groupssettings,像这样:

 $myClient->addScope('https://www.googleapis.com/auth/apps.groups.settings');
 $groupsettingsService = new Google_Service_Groupssettings($myClient);
 $group = $groupsettingsService->groups->get($groupId);
于 2015-03-27T07:39:47.900 回答