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

  • SEARCH
  • Home
  • 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 can easily get the unread notifications with this query: https://graph.facebook.com/USER_ID/notifications?access_token=ACCESS_TOKEN Is it possible
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
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
How do i get all users from a specific role? var users = Membership.GetAllUsers();
How do I get all words starting with $ (it's not a variable)? This
Can get all triples with value null in specific field? All people with date_of_birth

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.