Displaying a folder contents table
Applies to: Outlook 2013 | Outlook 2016
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
Call IMsgStore::OpenEntry, passing the entry identifier of the folder containing the table.
Call the folder's IMAPIContainer::GetContentsTable method to open its contents table.
Limit your view of the contents table if desired by calling the table's IMAPITable::SetColumns method to specify particular columns.
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:
Create a property restriction in an SPropertyRestriction structure that matches the PR_MESSAGE_CLASS (PidTagMessageClass) property with the desired message class.
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.
Create a restriction in an SAndRestriction structure that joins the property and bitmask restrictions.
Sort the contents table if desired by calling the table's IMAPITable::SortTable method.
Call IMAPITable::QueryRows to retrieve all of the rows from the contents table for processing.