Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The next function that you will implement is displaying the contents of the selected folder.
Add the methods shown in Listing 12-2 to the ExchangeDataContext class.
Listing 12-2. Reading the Mailbox Items
public List<Folder> GetFolders(FolderId parentFolderID)
{
return _service.FindFolders(parentFolderID, null).ToList();
}
public List<Item> GetMailboxItems(WellKnownFolderName folder)
{
return _service.FindItems(folder, new ItemView(30)).ToList();
}
public Item GetItem(ItemId itemId)
{
List<ItemId> items = new List<ItemId>() { itemId };
PropertySet properties = new PropertySet(BasePropertySet.IdOnly,
EmailMessageSchema.Body, EmailMessageSchema.Sender,
EmailMessageSchema.Subject);
properties.RequestedBodyType = BodyType.Text;
ServiceResponseCollection<GetItemResponse> response =
_service.BindToItems(items, properties);
return response[0].Item;
}