Platform SDK: MAPI

Displaying a Folder Contents Table

The contents table of a folder contains summary information about all of its messages. Summary information about new incoming messages appears in the contents table of the receive folder for the message class. To make this information available to users, retrieve the table and display the columns and rows as appropriate.

To display a folder contents table

  1. Call IMsgStore::OpenEntry, passing the entry identifier of the folder containing the table.
  2. Call the folder's IMAPIContainer::GetContentsTable method to open its contents table.
  3. Limit your view of the contents table if desired by calling the table's IMAPITable::SetColumns method to specify particular columns.
  4. Limit your view of the contents table if desired by calling the table's IMAPITable::Restrict method to filter particular rows. If, for example, you want to show only messages with a specific message class that have yet to be read:
    1. Create a property restriction in an SPropertyRestriction structure that matches the PR_MESSAGE_CLASS property with the desired message class.
    2. Create a bitmask restriction in an SBitmaskRestriction structure that uses PR_MESSAGE_FLAGS as the property tag and the MSGFLAG_UNREAD value as the mask.
    3. Create a restriction in an SAndRestriction structure that joins the property and bitmask restrictions.
  5. Sort the contents table if desired by calling the table's IMAPITable::SortTable method.
  6. Call IMAPITable::QueryRows to retrieve all of the rows from the contents table for processing.

Transport providers set the PR_MESSAGE_FLAGS property of incoming messages to MSGFLAG_FROMME if they were sent by the currently logged on user. If this flag is set and you are displaying the contents table of the Sent Items folder, show names of recipients rather than names of senders. Messages that have been saved during the composition process and not yet sent should also be displayed with recipient names rather than sender names.