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

Exchange Web Service 2007 SP1 "The property Body can't be used in FindItem requests".

$
0
0

I'm trying to get the body of the email back and I can't understand why I keep getting this error.  I've defined it in the PropertySet.

Here's a snippet of the code I'm using.

List<SearchFilter> searchFilterCollection = new List<SearchFilter>();
            searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Body, "Delivery has failed to these recipients or distribution lists"));

            // Find all items where the body contains "Delivery has failed to these recipients or distribution lists"
            SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection.ToArray());

            // Create a vwe with a page size of 50
            ItemView view = new ItemView(500);

            // IDentify the Subject and DateTimeRecieved properties to return.
            // Indicate that the base property will be the item identifier
            view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Subject, ItemSchema.DateTimeReceived, ItemSchema.Body);

            // Order the search results by the DateTimeRecieved in decending order
            view.OrderBy.Add(ItemSchema.DateTimeReceived, SortDirection.Descending);

            // Set the traveral to shallow. (SHallow is the default option; other options are Associated and SoftDeleted.)
            view.Traversal = ItemTraversal.Shallow;

            // Send the request to search teh Inbox and get the results.
            FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, searchFilter, view);


Viewing all articles
Browse latest Browse all 7132

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>