php-ews icon indicating copy to clipboard operation
php-ews copied to clipboard

get liste with primarySmtpAddress

Open patmicho opened this issue 8 years ago • 1 comments

Hello, I'm a beginner and i want to get the items of my reception box in using primarySmtpAddress.

i do this :

require_once "vendor/autoload.php";
$host       = 'mail.myhost.com';
$username   = 'myusername';
$password   = 'my password';
$email      = '[email protected]';
$api = \garethp\ews\MailAPI::withUsernameAndPassword(
        $host,
        $username,
        $password,
        [
            'primarySmtpEmailAddress' => $email
        ]
        );
$box = $api->getFolderByDistinguishedId('inbox');
echo "</br>Tot : ".$box->getTotalCount();
$mail = $api->getMailItems();

and I get:

Tot : 7

Fatal error: Uncaught garethp\ews\API\Exception\ExchangeException: When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids. in /Applications/MAMP/htdocs/ews_gareth/vendor/garethp/php-ews/src/API/ExchangeWebServices.php:417 Stack trace: #0 /Applications/MAMP/htdocs/ews_gareth/vendor/garethp/php-

thanks for your help

patmicho avatar Oct 07 '17 06:10 patmicho

Hi.

I'll look in to this. I may request more information to help fix this. What version are you using?

Garethp avatar Oct 26 '17 11:10 Garethp