Eric Legault
Eric Legault

Reputation: 5834

Searching folders by folder path in EWS using SOAP

Is it possible to do a SOAP search by PR_FOLDER_PATH? A simple search for any folder with "Inbox" in the path comes up empty:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <FindFolder Traversal="Deep" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
      <FolderShape>
        <t:BaseShape>Default</t:BaseShape>
        <t:AdditionalProperties>
          <t:FieldURI FieldURI="folder:FolderClass" />
          <t:ExtendedFieldURI PropertyTag="4340" PropertyType="Boolean" />
          <t:ExtendedFieldURI PropertyTag="26293" PropertyType="String" />
        </t:AdditionalProperties>
      </FolderShape>
      <Restriction>
        <t:Contains ContainmentMode="Substring" ContainmentComparison="IgnoreCase">
          <t:ExtendedFieldURI PropertyTag="26293" PropertyType="String" />
          <t:Constant Value="Inbox" />
        </t:Contains>
      </Restriction>
      <ParentFolderIds>
        <t:DistinguishedFolderId Id="msgfolderroot" />
      </ParentFolderIds>
    </FindFolder>
  </soap:Body>
</soap:Envelope>

Indeed, PR_FOLDER_PATH seems to be a bit of a mystery. I know its property tag is 26293 and I can see folder path values output in other search results. But I can't seem to find a way to even get values for this property listed in the EWS Editor, never mind having it work with search filters. What's the PID name equivalent? PR_FOLDER_PATH isn't even listed in MS-OXPROPS!

Upvotes: 0

Views: 510

Answers (1)

Glen Scales
Glen Scales

Reputation: 22032

I'm pretty sure its a computed property and is only valid in EWS in the FindFolder Operation because of the underlying Exchange operations that returns this (eg it won't work in a GetFolder operation in 2013 up).

An easy way to achieve what you want is just make the FindFolder on the Inbox which will give you all the folders with Inbox in the Path. For user created folders you will need to find the Id for the user created folder but it works similarly.

Cheers Glen

Upvotes: 1

Related Questions