Reputation: 27689
Im trying to retrieve all users from a domain, but I get an error..
Have downloaded the Zend library
Docs:
https://developers.google.com/google-apps/provisioning/?hl=da#retrieving_user_accounts
Get this error:
Fatal error: Call to undefined method Zend_Gdata_HttpClient::retrieveAllUsers()
script:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$email = '[email protected]';
$password = 'password';
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
echo '<pre>';
print_r($client->retrieveAllUsers());
echo '</pre>';
Upvotes: 0
Views: 498
Reputation: 843
Seems like you try to access the retrieveAllUsers method on an instance of the wrong object (Zend_Gdata_HttpClient instead of Zend_Gdata_Gapps).
Try this:
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
$gdata = new Zend_Gdata_Gapps($client, 'mydomain.com');
$users = $gdata->retrieveAllUsers();
Upvotes: 1