title: Exchange Web Service get Public Subfolder with PHP-EWS
body: <p>I'm using PHP-EWS (<a href="https://github.com/jamesiarmes/php-ews" rel="nofollow noreferrer">https://github.com/jamesiarmes/php-ews</a>) inside a cakePHP application. The goal is to read E-Mails from a "Public Folder" from the exchange server.</p>
  
  <p>The Problem is I can only read the first "Dimension" of public folders and can't find a way to get the subdirectorys. </p>
  
  <p>The folder I have to read from is 4 levels deep.</p>
  
  <pre><code> $this-&gt;connect();
  
  // start building the find folder request 
  $request = new FindFolderType();
  $request-&gt;Traversal = FolderQueryTraversalType::SHALLOW;
  $request-&gt;FolderShape = new FolderResponseShapeType();
  $request-&gt;FolderShape-&gt;BaseShape = DefaultShapeNamesType::ALL_PROPERTIES;
  
  // configure the view
  $request-&gt;IndexedPageFolderView = new IndexedPageViewType();
  $request-&gt;IndexedPageFolderView-&gt;BasePoint = 'Beginning';
  $request-&gt;IndexedPageFolderView-&gt;Offset = 0;
  
  // set the starting folder
  $request-&gt;ParentFolderIds = new NonEmptyArrayOfBaseFolderIdsType();
  $request-&gt;ParentFolderIds-&gt;DistinguishedFolderId = new    DistinguishedFolderIdType();
  $request-&gt;ParentFolderIds-&gt;DistinguishedFolderId-&gt;Id = DistinguishedFolderIdNameType::PUBLIC_FOLDERS_ROOT;
  
  // request 
  $response = $this-&gt;ews-&gt;FindFolder($request);
  </code></pre>
  
  <p>If I change "Traversal" to DEEP I get the error .</p>
  
  <blockquote>
    <p>DEEP TRAVERSAL queries are not allowed for public folders.</p>
  </blockquote>
  
  <p>I also tried to change</p>
  
  <pre><code>$request-&gt;IndexedPageFolderView-&gt;BasePoint
  </code></pre>
  
  <p>To things like "end" "second", it didn't change anything so I could not figure out what it does and how to use it.</p>
  
  <p>I can't get the subdirectory Folder id (for changing the start point) either because it gets never selected.</p>
  
  <p>Thank you for your help.</p>