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

Get only mails of a folder

Open r-hede opened this issue 7 years ago • 0 comments

Hi,

I'm trying to get only mails of a folder but the following code doesn't work and I don't understand why.

$api = garethp\ews\MailAPI::withUsernameAndPassword($host, $login, $password);

$mails = $api->getMailItems($folderId,
    [
        'Restriction' => [
            'IsEqualTo' => [
                'FieldURI' => [
                    'FieldURI' => garethp\ews\API\Enumeration\UnindexedFieldURIType::ITEM_CLASS
                ],
                'FieldURIOrConstant' => [
                    'Constant' => [
                        'Value' => 'IPM.Note'
                    ]
                ]
            ]
        ]
    ]
);

Is my restriction correct?

r-hede avatar Feb 21 '18 12:02 r-hede