none
[EWS] Accessing Flagged Items and Tasks RRS feed

  • Question

  • In OWA and Office 365, I can "flag" an email, and it then appears in the folder "Flagged Items and Tasks".  I would like to use EWS (direct XML, not the managed API) to read these items.   However, when I use "FindFolder Traversal=Deep" to get a list of my EWS folders, "Flagged Items and Tasks" is not among them.  I do have the normal "Tasks" folder, but the flagged item is not there, only normal tasks.  Am I doing something wrong, or is there no way to retrieve flagged emails?


    Jeffrey McKay

    Monday, August 27, 2012 10:20 PM

All replies

  • This folder is a Search folder called "To-Do Search" and it located under the NON_IPM_Subtree so if you do a search from the Root rather then MSGRoot you should be able to find it eg

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="
    http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://sc
    hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xml
    soap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2010_SP2" />
        </soap:Header>
        <soap:Body>
          <m:FindFolder Traversal="Shallow">
            <m:FolderShape>
              <t:BaseShape>AllProperties</t:BaseShape>
            </m:FolderShape>
            <m:IndexedPageFolderView MaxEntriesReturned="1" Offset="0" BasePoint="Be
    ginning" />
            <m:Restriction>
              <t:IsEqualTo>
                <t:FieldURI FieldURI="folder:DisplayName" />
                <t:FieldURIOrConstant>
                  <t:Constant Value="To-Do Search" />
                </t:FieldURIOrConstant>
              </t:IsEqualTo>
            </m:Restriction>
            <m:ParentFolderIds>
              <t:DistinguishedFolderId Id="root" />
            </m:ParentFolderIds>
          </m:FindFolder>
        </soap:Body>
      </soap:Envelope>

    The other way of getting the Id is to use the PidTagAdditionalRenEntryIdsEx extended property http://msdn.microsoft.com/en-us/library/office/cc842311.aspx on the Root Folder. I would suggest having a look at the format using a Mapi editor like OutlookSpy or MFCMapi.

    Cheers
    Glen

    Tuesday, August 28, 2012 2:52 AM
  • Hey Glen,

    Do you know if I this search folder supports these things:

    - Search exclusively for tasks, or exclusively emails or contacts that were flagged ?

    - Search for changes since a certain date, or a certain substitution ID (to only get the delta of changes when keeping this folder in sync).

    Thanks

    Friday, November 16, 2012 10:46 PM
  • A Search Folder is already a Restriction (a permanent one) so if you where to search on top of this restriction your putting a dynamic restriction on a permanent restriction which is supported but your millage may vary if your searches are really complex. You may be better just grabbing all the Items in the search folder (I don't think you every get a large volume of Items) then filter them at the client side which I'm sure would be faster, more reliable and easier on the Exchange Store then trying to pile a search on top (if its a simple search on a Indexed property its probably not that big a deal). Its something you need to test and see what works the best.

    Cheers
    Glen

    Monday, November 19, 2012 5:51 AM