Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:07:36+00:00 2026-05-24T03:07:36+00:00

How do you get all unread mail in a users’ exchange mailbox using PHP

  • 0

How do you get all unread mail in a users’ exchange mailbox using PHP while using this class ?

I figured to first list a folders contents like this:

$ews = new ExchangeWebServices("mailserver.domain.local", "user", "pass");

$request = new EWSType_FindFolderType();
$request->FolderShape = new EWSType_FolderResponseShapeType();
$request->FolderShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;

$request->Traversal = new EWSType_FolderQueryTraversalType();

$result = $ews->FindFolder($request);

var_dump($result);

Only then I get this error:

Catchable fatal error: Object of class EWSType_FolderQueryTraversalType could not be converted to string

Is there anybody with experience with this class that can tell me what I’m doing wrong?

I do know that a string has to be passed, but it seems the class has just 3 constants without any functions or other properties..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:07:36+00:00Added an answer on May 24, 2026 at 3:07 am

    I figured it out, in above example I had to use

    $request->Traversal = EWSType_FolderQueryTraversalType::DEEP;
    

    Since it only had the 3 constants.

    But posting it here since I think it might be useful for anyone else looking to do the same, listing all mail in your inbox goes as follows:

    $ews = new ExchangeWebServices("mailserver.domain.local", "user", "pass");
    
    $request = new EWSType_FindItemType();
    $request->ItemShape = new EWSType_ItemResponseShapeType();
    $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
    
    $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
    $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
    $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;
    
    $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
    
    $result = $ews->FindItem($request);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using a php wrapper to find all unread sms messages from my google
I'm trying to get all the assets where Class property equals to one of
I'm trying to get all records with date greater then now. I tried this
How get all selected values (not empty) for all selects in document using Prototype
I get all the images with this preg_match_all('!http://.+\.(?:jpe?g|png|gif)!Ui' , $content , $matches); and this
I get all the time this error: exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified
I'm trying to get all dependencies (include transitives) within my plugin using mavenProject.getArtifacts() but
Can get all triples with value null in specific field? All people with date_of_birth
How can I get all items from a specific calendar (for a specific date).
I'm trying to get all the direct reports of a User through Active Directory,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.