Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-62166BC9-D0BC-5070-BC57-2A1F4948BAFE" xml:lang="en"><title>Restoring
Email Messages</title><shortdesc>This tutorial exaplins hwo to restore email messages for sending
in chunks. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<section><title>Procedure</title> <ol id="GUID-CC5BDBE0-C0DF-589F-A88F-B8D7D804C6CE">
<li id="GUID-08387B03-73BC-545E-B2B5-EB9D1186A31A"><p>The MTM that needs to
restore message data from message store in chunks should get the <xref href="GUID-6A4CAFB0-262A-3721-B91B-07F2C3B64B5F.dita"><apiname>CMsvPlainBodyText</apiname></xref> object
using the <xref href="GUID-64068543-5092-3197-AB0C-E42A96E2075C.dita"><apiname>InitialisePlainBodyTextForReadL()</apiname></xref> method of <xref href="GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE.dita"><apiname>CMsvStore</apiname></xref>. </p> </li>
<li id="GUID-7E8C3041-3A11-5266-9BB6-FDAE2BB4F4FD"><p>Set <xref href="GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE.dita"><apiname>CMsvStore</apiname></xref> to
the ID whose body text needs to be stored, and open it in the read mode. </p> </li>
<li id="GUID-4DB1F50F-DFD6-585D-ABBD-2EFC29C88326"><p>Use any of the following <xref href="GUID-6A4CAFB0-262A-3721-B91B-07F2C3B64B5F.dita#GUID-6A4CAFB0-262A-3721-B91B-07F2C3B64B5F/GUID-7EE4AF2A-6DD6-399A-A9F6-6192107A9CA9"><apiname>CMsvPlainBodyText::NextChunkL()</apiname></xref> methods
to get the email message in chunks: </p> <ol id="GUID-F761D85A-AFB3-59E0-A73F-B2EB0B5C4D60">
<li id="GUID-D8CFEC49-8A2E-5D5D-9ABC-81D586663581"><p> <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8 </apiname></xref> <codeph>&aChunk</codeph> </p> </li>
<li id="GUID-BFCE36F8-217F-5FBE-922E-81D39CDF4E6B"><p> <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref> <codeph>&aChunk</codeph>, <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> <codeph>&aStatus</codeph> </p> </li>
<li id="GUID-3E632136-5124-5BDF-80BB-62D766659F4C"><p> <xref href="GUID-C04A9A0C-DBA7-37DA-B744-54FBF3D544CD.dita"><apiname>TDes16</apiname></xref> <codeph> &aChunk</codeph> </p> </li>
<li id="GUID-BCF5D75D-0174-5450-B47E-8833FC835CC7"><p> <xref href="GUID-C04A9A0C-DBA7-37DA-B744-54FBF3D544CD.dita"><apiname>TDes16</apiname></xref> <codeph>&aChunk</codeph>, <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> <codeph>&aStatus</codeph> </p> </li>
</ol> <p>The length of the chunk to be restored in a single call to <codeph>NextChunkL()</codeph> is
decided by the MTM, when it initialises <xref href="GUID-6A4CAFB0-262A-3721-B91B-07F2C3B64B5F.dita"><apiname>CMsvPlainBodyText</apiname></xref> for
the read operation. </p> <note> The email application can call <codeph>NextChunkL()</codeph> until
the length of the chunk populated by <codeph>NextChunkL()</codeph> is <codeph>0</codeph>.</note></li>
<li id="GUID-101359C2-A3FF-580A-9A3A-02CA1DE33A4D"><p>The retrieved message
data can be sent by the MTM in chunks. </p> </li>
</ol><note> The MTM can also use the existing <xref href="GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE.dita#GUID-8CB90FA2-A6CF-3FA2-81FF-7D22EFD9C2CE/GUID-8825B8E5-0285-3F0B-965D-D67F0F767D1B"><apiname>CMsvStore::RestoreBodyTextL()</apiname></xref> method
to retrieve the entire body text in a single operation. To do this, the plain
text body of the email message, which is stored in the message store, will
be copied to the <xref href="GUID-39945DA4-B362-3DF6-BF9E-DD079EEA7934.dita"><apiname>CRichText</apiname></xref> reference and passed to <codeph>RestoreBodyTextL()</codeph>. </note> </section>
</conbody><related-links>
<link href="GUID-3FD5C609-3727-53B6-900F-ACBE59F62E4A.dita"><linktext>Storing Downloaded
Email Messages</linktext></link>
<link href="GUID-2C8653F9-8873-59E8-9FD2-4215F6877ABC.dita"><linktext>Chunk Method
to Process Emails</linktext></link>
<link href="GUID-D73AD200-BE4D-50BF-BCF9-14627DE530B7.dita"><linktext>Imap4Example:
An Email manager using IMAP4 and SMTP</linktext></link>
<link href="GUID-BB35DBCC-FE56-547F-BADA-9EF854691ADC.dita"><linktext>Pop3Example:
An Email manager using POP3 and SMTP</linktext></link>
</related-links></concept>