You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a shared folder with subfolders, and I am trying to search a string in the subject of each email, that works ok, but only if the email is allocated in the inbox root.
Inbox Root
new
queue
completed
but if the email is allocated in some of the subfolder (new,queue,compelted), I get a error .
how I can search more deeper? (search in subfolder)
this is my code.
$ews = new ExchangeWebServices($host, $username, $password, ExchangeWebServices::VERSION_2010);
$request = new EWSType_FindItemType();
$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
I have a shared folder with subfolders, and I am trying to search a string in the subject of each email, that works ok, but only if the email is allocated in the inbox root.
but if the email is allocated in some of the subfolder (new,queue,compelted), I get a error .
how I can search more deeper? (search in subfolder)
this is my code.
$ews = new ExchangeWebServices($host, $username, $password, ExchangeWebServices::VERSION_2010);
$request = new EWSType_FindItemType();
$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
$request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;
$request->IndexedPageItemView = new EWSType_IndexedPageViewType();
$request->IndexedPageItemView->MaxEntriesReturned = 25;
$request->IndexedPageItemView->BasePoint = 'Beginning';
$request->IndexedPageItemView->Offset = 0;
$EmailAddy = "email@email.com";
$mailBox = new EWSType_EmailAddressType();
$mailBox->EmailAddress = $EmailAddy;
$request->ParentFolderIds->DistinguishedFolderId->Mailbox = $mailBox;
$folder_id = 'folder.id';
$request->ParentFolderIds->FolderId = new EWSType_FolderIdType();
$request->ParentFolderIds->FolderId->Id = $folder_id;
$request->Restriction = new EWSType_RestrictionType();
$request->Restriction->Contains = new EWSType_ContainsExpressionType();
$request->Restriction->Contains->FieldURI = new EWSType_PathToUnindexedFieldType();
$request->Restriction->Contains->FieldURI->FieldURI = 'item:Subject';
$request->Restriction->Contains->Constant = new EWSType_ConstantValueType();
$request->Restriction->Contains->Constant->Value = 'value-to-search-in-the-subject'
$request->Restriction->Contains->ContainmentComparison = new EWSType_ContainmentComparisonType();
$request->Restriction->Contains->ContainmentComparison->_ = EWSType_ContainmentComparisonType::IGNORE_CASE;
$request->Restriction->Contains->ContainmentMode = new EWSType_ContainmentModeType();
$request->Restriction->Contains->ContainmentMode->_ = EWSType_ContainmentModeType::SUBSTRING;
$request->SortOrder = new EWSType_NonEmptyArrayOfFieldOrdersType();
$request->SortOrder->FieldOrder = array();
$order = new EWSType_FieldOrderType();
$order->FieldURI->FieldURI = 'item:DateTimeReceived';
$order->Order = 'Ascending';
$request->SortOrder->FieldOrder[] = $order;
$response = $ews->FindItem($request);
The text was updated successfully, but these errors were encountered: