Symbian3/PDK/Source/GUID-1DCB0B64-0B70-4F34-81A7-E00A996AD626.dita
changeset 5 f345bda72bc4
child 9 59758314f811
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-1DCB0B64-0B70-4F34-81A7-E00A996AD626" xml:lang="en"><title>Listing,
       
    13 Accessing and Launching Mailboxes</title><shortdesc>This section describes how to list, access and launch mailboxes
       
    14 using Email Client APIs.</shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    15 <context id="GUID-A90D8897-55A2-4D4C-9B22-DA8620B4FD83">       <p>Email Client
       
    16 provides <xref href="GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290.dita#GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290/GUID-015F8AAA-1C6B-3871-98B3-4058DE874C24"><apiname>MEmailMailbox::GetMailboxesL()</apiname></xref> method to list
       
    17 all the mailboxes. <xref href="GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290.dita#GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290/GUID-BC053BE5-CD31-3787-AFB9-6C52690FBD7A"><apiname>MEmailMailbox::ShowInboxL()</apiname></xref> method is
       
    18 used to launch a specific mailbox in the email application. </p>     </context>
       
    19 <steps id="GUID-4DD07DEC-6017-4237-BE46-1D69E5FBD744-GENID-1-10-1-7-1-1-4-1-3-1-5-1-4-1-3-2">
       
    20 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-7-1-1-4-1-3-1-5-1-4-1-3-2-1"><cmd>Create an instance
       
    21 of <xref href="GUID-EAFF40CE-09E4-3739-A533-400CBA63C3BD.dita"><apiname>MEmailClientApi</apiname></xref> class.</cmd>
       
    22 <info><p><codeblock xml:space="preserve">EmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL();
       
    23 CleanupStack::PushL( factory );
       
    24 MEmailClientApi* mailClient = static_cast&lt;MEmailClientApi*&gt;(factory-&gt;InterfaceL( KEmailClientApiInterface ) );</codeblock></p></info>
       
    25 </step>
       
    26 <step id="GUID-9A69E5AD-E938-4092-A8C2-CB65C37C8962-GENID-1-10-1-7-1-1-4-1-3-1-5-1-4-1-3-2-2"><cmd>Get the mailboxes
       
    27 using <xref href="GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290.dita#GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290/GUID-06D34B16-19A5-34B9-B55F-882AFD30427F"><apiname>MEmailMailbox::GetMailboxesL(RMailboxPtrArray&amp; aMailboxes)</apiname></xref>.</cmd>
       
    28 <info><p><codeblock xml:space="preserve">RMailboxPtrArray mailboxes;
       
    29 CCleanupResetAndRelease&lt;MEmailMailbox&gt;::PushL( mailboxes );
       
    30 mailClient-&gt;GetMailboxesL( mailboxes );
       
    31 </codeblock></p></info>
       
    32 </step>
       
    33 <step id="GUID-6363BB6A-DC04-4E0A-B3C8-6F20CF13C1D9"><cmd>Launch the inbox
       
    34 using <xref href="GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290.dita#GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290/GUID-BC053BE5-CD31-3787-AFB9-6C52690FBD7A"><apiname>MEmailMailbox::ShowInboxL()</apiname></xref>.</cmd>
       
    35 <info><p><codeblock xml:space="preserve">mailbox-&gt;ShowInboxL();</codeblock></p><p>To access a mailbox
       
    36 using its address, use <xref href="GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290.dita#GUID-FCDFA4A7-2C82-3FE7-8C0B-2035C6602290/GUID-2FFBCEFB-B5D4-3924-B44D-AB608E0F2603"><apiname>MEmailMailbox::MailboxL( const TPtrC&amp;
       
    37 aAddress)</apiname></xref> method.</p></info>
       
    38 </step>
       
    39 </steps>
       
    40 <example><p>The following code snippet shows an example of how to list the
       
    41 mailboxes.</p><p><codeblock xml:space="preserve">TInt CEmailClientApiTester::GetMailboxListL( CItemParser&amp; /*aItem*/ )
       
    42 	{
       
    43 		TInt ret(KErrNone);
       
    44 
       
    45 		CEmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL();
       
    46 		CleanupStack::PushL( factory );
       
    47 		MEmailClientApi* mailClient = static_cast&lt;MEmailClientApi*&gt;(factory-&gt;InterfaceL( KEmailClientApiInterface ) );
       
    48 		if ( mailClient )
       
    49 			{
       
    50 				CleanupReleasePushL( *mailClient );
       
    51 				RMailboxPtrArray mailboxes;
       
    52 				mailClient-&gt;GetMailboxesL( mailboxes );// Get the mailboxes
       
    53 				for ( TInt i = 0; i &lt; mailboxes.Count(); i++ )
       
    54 					{
       
    55 						MEmailMailbox* mailbox = mailboxes[i];
       
    56 						iLog-&gt;Log( _L( "%S id=%d" ), &amp;mailbox-&gt;MailboxName(), mailbox-&gt;MailboxId().iId );            
       
    57 						mailbox-&gt;Release(); //Release the memory
       
    58 					}
       
    59 				mailboxes.Close();
       
    60 				CleanupStack::PopAndDestroy();// mailClient
       
    61 			}
       
    62 		CleanupStack::PopAndDestroy(factory);     
       
    63 		return ret;
       
    64 	}
       
    65 </codeblock></p></example>
       
    66 </taskbody><related-links>
       
    67 <link href="GUID-B87B9E01-F5EB-40F6-A580-A7E46869AE39.dita"><linktext>Email Client
       
    68 API Overview</linktext></link>
       
    69 <link href="GUID-FC308B84-E109-48F3-90F1-78F0C837CC56.dita"><linktext>Creating,
       
    70 Replying and Forwarding Email Messages</linktext></link>
       
    71 <link href="GUID-222C2B18-F348-4B16-BB00-E5FAC11AE528.dita"><linktext>Searching
       
    72 Email Messages</linktext></link>
       
    73 </related-links></task>