I'm attempting to retrieve a list of emails by a particular sender on an exchange server using PHP EWS.
My code sample related specifically to the restriction (search) construction:
$request->Restriction = new EWSType_RestrictionType();
$request->Restriction->IsEqualTo = new EWSType_IsEqualToType();
$request->Restriction->IsEqualTo->FieldURI = new EWSType_PathToUnindexedFieldType();
$request->Restriction->IsEqualTo->FieldURI->FieldURI = 'message:Sender';
$request->Restriction->IsEqualTo->FieldURIOrConstant = new EWSType_FieldURIOrConstantType();
$request->Restriction->IsEqualTo->FieldURIOrConstant->Constant->Value = 'Bob Smith';
This type of restriction results in zero results.
I notice that when I search without restrictions, the result returned contains the sender information (but it is nested). eg:
[Sender] => stdClass Object
(
[Mailbox] => stdClass Object
(
[Name] => Bob Smith
)
)
How do I cater for the nested information in the restriction?
Other search expression examples: https://github.com/jamesiarmes/php-ews/wiki/Search-Expression:-Simple-Conditions