How Can i create a Alias for a user using Google_DirectoryService ?

36 views
Skip to first unread message

silvio...@cepromat.mt.gov.br

unread,
Sep 26, 2013, 5:36:09 PM9/26/13
to google-api...@googlegroups.com
I'm trying this:

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_DirectoryService.php';

session_start();

$gClient = new Google_Client();
$gClient->setApplicationName('apigoogle');
$gClient->setClientId('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$gClient->setClientSecret('XXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$gClient->setRedirectUri('http://localhost/oauth2callback');
$gClient->setDeveloperKey('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$directory = new Google_DirectoryService($gClient);

$Alias = new Google_Alias();
$Alias->setAlias('foif...@test.com');
$Alias->setPrimaryEmail('glpi...@test.com');

$servicoAlias = new Google_UsersAliasesServiceResource();

print $servicoAlias->insert('glpi...@test.com', $Alias);

But this don't work, the Google_UsersAliasesServiceResource class needs 4 variables of parameters, but i don't know how use, sombeboy can helpe me?

thanks
Reply all
Reply to author
Forward
0 new messages