This example displays information about the messages in the inbox, with output like:
Inbox contains 2 messages
|-----> Test User1 | Working Remotely with Windows Small Business Server
|-----> Test User1 | Welcome to Windows Small Business Server 2003
The example shows how to create a session, get the message_store, and open the inbox folder. It then determines how many messages are in the inbox folder, and retrieves and prints the intended addressee and the message subject.
#include <exception>
#include <string>
int main ()
{
try {
std::cout << "Inbox contains " << messages.size() << " messages" << std::endl;
for (unsigned int i = 0; i < messages.size(); ++i) {
msg_props << PR_DISPLAY_TO << PR_CONVERSATION_TOPIC;
if (msg_props[PR_DISPLAY_TO] != 0) {
std::cout << "|-----> " << (const char*)msg_props[PR_DISPLAY_TO];
if(msg_props[PR_CONVERSATION_TOPIC] != 0) {
std::cout << "\t\t| " << (const char*)msg_props[PR_CONVERSATION_TOPIC];
}
std::cout << std::endl;
}
}
}
{
std::cout <<
"MAPI Exception in main: " << e.
what()
<< std::endl;
}
catch (std::runtime_error e)
{
std::cout << "std::runtime_error exception in main: "
<< e.what() << std::endl;
}
return 0;
}