List of aliases of an user with gmail API in PHP

113 Views Asked by At

I try to find all aliases from an user with the gmail API with PHP :

function recupererAlias($user)
{
   $gmail = objetGmailAPI($user);
    try
    {
       $req = $gmail->users_settings_sendAs->list($user);
       return $req;
    } catch (exception $e) {
        return 'Error<hr/>'.$e;
    }
}

The error is:

Call to undefined method Google_Service_Gmail_Resource_UsersSettingsSendAs::list(

Why?

1

There are 1 best solutions below

0
On

The correct syntax is :

function recupererAlias($user)
{
   $gmail = objetGmailAPI($user);
    try
    {
       $req = $gmail->users_settings_sendAs-> listUsersSettingsSendAs($user);
       return $req;
    } catch (exception $e) {
        return 'Error<hr/>'.$e;
    }
}

Thank you to El_Vanja for the help, I see the documentation like his advice. Thanks again :)