Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Using FindItems with EWSMA to display All Mail Items from an email

$
0
0

I would like to use the EWSMA to show all emails from a given user.  Currently my sample code just shows the emails from the given user in the Inbox and not the sub-folders.  How can I ensure that FindItems will search the subfolders as well?

Also, what is the property to check if the email is flagged in Outlook and on the Exchange Web App?  I am testing against an Office365 Exchange account.

 

privatestaticvoid SearchItems()
    {
        ItemView iv = new ItemView(10);
        FindItemsResults<Item> 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:\t\t" + item.DateTimeReceived.ToString("dd MMMM yyyy"));
            Console.WriteLine();
        }

        Console.WriteLine("Press Enter to continue");
        Console.ReadLine();
    }



Viewing all articles
Browse latest Browse all 7132

Trending Articles