Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 12: Developing Exchange Online S... > Accessing the Folder Contents

Accessing the Folder Contents

The next function that you will implement is displaying the contents of the selected folder.

Retrieving Items from Exchange

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;
}

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint