This section describes how to list, access and launch mailboxes using Email Client APIs.
Email Client provides MEmailMailbox::GetMailboxesL() method to list all the mailboxes. MEmailMailbox::ShowInboxL() method is used to launch a specific mailbox in the email application.
The following code snippet shows an example of how to list the mailboxes.
TInt CEmailClientApiTester::GetMailboxListL( CItemParser& /*aItem*/ )
{
TInt ret(KErrNone);
CEmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL();
CleanupStack::PushL( factory );
MEmailClientApi* mailClient = static_cast<MEmailClientApi*>(factory->InterfaceL( KEmailClientApiInterface ) );
if ( mailClient )
{
CleanupReleasePushL( *mailClient );
RMailboxPtrArray mailboxes;
mailClient->GetMailboxesL( mailboxes );// Get the mailboxes
for ( TInt i = 0; i < mailboxes.Count(); i++ )
{
MEmailMailbox* mailbox = mailboxes[i];
iLog->Log( _L( "%S id=%d" ), &mailbox->MailboxName(), mailbox->MailboxId().iId );
mailbox->Release(); //Release the memory
}
mailboxes.Close();
CleanupStack::PopAndDestroy();// mailClient
}
CleanupStack::PopAndDestroy(factory);
return ret;
}
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.