Partager via


Displaying a Folder Contents Table

Applies to: Office 2010 | Outlook 2010 | Visual Studio

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 (PidTagMessageClass) property with the desired message class.

    2. Create a bitmask restriction in an SBitMaskRestriction structure that uses PR_MESSAGE_FLAGS (PidTagMessageFlags) 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.