How to find emails in all folders using EWS

1129100 pts.
Tags:
EWS
Exchange Server
I'm using the following code to find all emails sent from a user but the code only has been searching the main inbox folder and doesn't check the sub-folders. I need it to search all mail items including the sub-folders. Here's the code:
    private static void SearchItems(string email)
    {
        ItemView iv = new ItemView(10);
        FindItemsResults fiitems = _service.FindItems(WellKnownFolderName.Inbox, "from:username@example.com", iv);

        foreach (Item item in fiitems)
        {
            Console.WriteLine("Subject:t" + item.Subject);
            Console.WriteLine("Received At:tt" + item.DateTimeReceived.ToString("dd MMMM yyyy"));
            Console.WriteLine();
        }

        Console.WriteLine("Press Enter to continue");
        Console.ReadLine();
    }
What am I missing?
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: