Symbian3/SDK/Source/GUID-382B8A9D-9D10-54CD-91A6-B9E7A2477662.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 15:24:34 +0100
changeset 9 59758314f811
parent 8 ae94777fff8f
child 13 48780e181b38
permissions -rw-r--r--
Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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-382B8A9D-9D10-54CD-91A6-B9E7A2477662" xml:lang="en"><title>SendAs v2.0</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-9D54D47A-37D9-5229-92D5-B80B442E8B0D"><title>Description</title> <p>The application establishes a session with the SendAs server,
sets a message entry, creates a message, sets its body text, adds
a recipient, sends the message and closes the session. The sequence
of events is detailed in the following list: </p> <ul>
<li id="GUID-ADE16BD9-7B38-5B35-8E72-77E968D1CED2"><p>Create a session
with the SendAs server using <xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita#GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B/GUID-1B5B3FA7-403E-354A-8CF3-C04FF58CF293"><apiname>CMsvSession::OpenSyncL(MMsvSessionObserver
&amp;)</apiname></xref> function. </p> </li>
<li id="GUID-E1BF3D0E-C278-57F6-9359-4EDC426034BD"><p>Set the message
entry using the <xref href="GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49.dita#GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49/GUID-6048C7BC-8D3E-34C5-81C1-317521218029"><apiname>CMsvEntry::SetEntryL(TMsvId)</apiname></xref> function. </p> </li>
<li id="GUID-C89C044C-B1DF-5541-8F0E-81DBA222E126"><p>After setting
the entry, the application gets a selection containing the IDs of
all the context children, using the <xref href="GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49.dita#GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49/GUID-7058F4C4-7EE9-36C3-ACE9-632345D7FF44"><apiname>CMsvEntry::ChildrenL()const</apiname></xref> function. </p> </li>
<li id="GUID-B2B5D96F-68F3-5000-B615-3AE7DA32E3A3"><p>The connection
to the server is made using the default number of message slots available
to a session, which is 4, (<xref href="GUID-C248C8F6-46F2-39AB-A202-CB2D98FCF760.dita"><apiname>KSendAsDefaultMessageSlots</apiname></xref>). </p> </li>
<li id="GUID-5469B019-40CD-5864-BF4B-43DEC2FDF34F"><p>The draft folder
is emptied, before creating a new message. </p> </li>
<li id="GUID-A1D2D778-42D2-51DA-817C-65E350BABB9C"><p>Fetch the names
and UIDs for the filtered list of message types using the <xref href="GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3.dita#GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3/GUID-B94FAE68-3EB9-3E01-97B7-3A77CE5A4740"><apiname>RSendAs::FilteredMessageTypesL()</apiname></xref> function to create a SendAs
message. Then the UID based on the message type is returned, and with
the entry set on the drafts folder a SendAs message is created by
calling the <xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita#GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6/GUID-F5C5023D-0066-3DD7-BFFA-CCA8E0DD1C76"><apiname>RSendAsMessage::CreateL(RSendAs &amp;,TSendAsAccount)</apiname></xref> function. </p> </li>
<li id="GUID-8CE79BC4-4240-5E94-851B-2E13DFB3B271"><p>Set a body text
for the message and specify the recipients. In this example, the body
text is set using an option, which is read from the user. Option given
to the user are '1' for 8-bit encoding, '2' for 16-bit encoding and
'0' or by default its unicode type of encoding. The encoded descriptor
is set as the message's body text using the <xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita#GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6/GUID-22E37DB6-35A2-3B01-A785-189B92A7E8D4"><apiname>RSendAsMessage::SetBodyTextL(const
CRichText &amp;)</apiname></xref>function. </p></li>
<li><p>The recipients are added using the <xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita#GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6/GUID-106A7A1C-023B-33EB-8925-859E2088FF24"><apiname>RSendAsMessage::AddRecipientL(const
TDesC &amp;,TSendAsRecipientType)</apiname></xref> function. The recipient's
address is held in a descriptor. The alias is the displayed recipient
name.</p></li>
<li id="GUID-EB161170-E53F-5892-B7A6-6DF4529C924D"><p>The recipient
type is one of the <xref href="GUID-3DFEC3A5-1DDB-3BF0-871A-91B96F06EC42.dita"><apiname>TSendAsRecipientType</apiname></xref> enumeration
values, that is, one of the following: </p> <ul>
<li id="GUID-7D3CA067-B14A-5694-9C80-3FA740E1D3AA"><p> <xref href="GUID-D8B673F7-1367-3228-813A-D74138533BC2.dita"><apiname>ESendAsRecipientTo</apiname></xref> - The recipient goes in the 'To' field. </p> </li>
<li id="GUID-6E67C22D-4C3F-5F77-8454-AF35290C31A6"><p> <xref href="GUID-A990E3D5-E20A-3CDA-9417-15C234E85F57.dita"><apiname>ESendAsRecipientCc</apiname></xref> - The recipient goes in the 'Cc' field </p> </li>
<li id="GUID-0D5D7039-1970-579C-8629-5C41C3B3538D"><p> <xref href="GUID-EF736A4B-685E-3E77-B4A1-E1B06EAD2523.dita"><apiname>ESendAsRecipientBcc</apiname></xref> - The recipient goes in the 'Bcc' field </p> </li>
</ul> <p>If the 'Cc' field is not supported, the recipient will instead
be added to the 'To' field since these are functionally equivalent. </p> <p>If the 'Bcc' field is not supported, this function will return <xref href="GUID-F89DA3F0-2A48-3F9B-8F08-29350E92D0E4.dita"><apiname>KErrNotSupported</apiname></xref>. </p> </li>
</ul> <p>The example also displays the names of the accounts present
in the list. </p> <p>To demonstrate this, 3 new accounts are appended
and they are displayed in a for-loop by calling <xref href="GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4.dita#GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4/GUID-1FB61663-625D-3294-84BA-D811044D1235"><apiname>CSendAsAccounts::AccountNames().MdcaPoint(i)</apiname></xref>, where the <xref href="GUID-7D6D682B-4ACD-312E-B0BE-D182930182D0.dita"><apiname>MdcaPoint()</apiname></xref> function takes in the
integer value of the current iteration in the for-loop and indexes
into a descriptor array. </p> <p>The example also demonstrates how
to refine the available message types of the connected session using
the <xref href="GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3.dita#GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3/GUID-C87673B0-714F-31C0-9F9E-C095669007AF"><apiname>RSendAs::FilterAgainstCapability()</apiname></xref> function. </p> <p>The <xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita#GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6/GUID-28EE1E22-8892-388C-990D-BC0E1F18D88E"><apiname>RSendAsMessage::SendMessage()</apiname></xref> function
is used asynchronously to send the message. Finally the <xref href="GUID-2A8E907A-B3AE-3D83-882C-ED0A98B5D39A.dita#GUID-2A8E907A-B3AE-3D83-882C-ED0A98B5D39A/GUID-1EDE87E5-3F1C-34E2-9172-72990783E7E7"><apiname>RsendAs::Close()</apiname></xref> function is used to end the session with SendAs server. </p> </section>
<section id="GUID-5D17C0D4-1D8E-5E85-AEFD-7083A748C728"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-90c56a55-33bb-4ab7-a6b8-8932ba181dc8.zip" scope="external">sendAs.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-90c56a55-33bb-4ab7-a6b8-8932ba181dc8.html" scope="peer">browse </xref> to view the example code. </p> </section>
<section id="GUID-3AE6EA98-02BC-41BD-AC4E-157A6700A12A"><title>Class
summary</title><p> The SendAs v2 example application uses the following
classes:</p><ul>
<li><p><xref href="GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49.dita"><apiname>CMsvEntry </apiname></xref></p></li>
<li><p><xref href="GUID-B36289AC-769F-3A83-BADB-AE0568E97581.dita"><apiname>MMsvEntryObserver </apiname></xref></p></li>
<li><p><xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita"><apiname>CMsvSession </apiname></xref></p></li>
<li><p><xref href="GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3.dita"><apiname>RSendAs </apiname></xref></p></li>
<li><p><xref href="GUID-CB2BB982-F91D-3E06-8D66-56731AA60EB8.dita"><apiname>CSendAsMessageTypes </apiname></xref></p></li>
<li><p><xref href="GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4.dita"><apiname>CSendAsAccounts </apiname></xref></p></li>
<li><p><xref href="GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4.dita"><apiname>CSendAsAccounts </apiname></xref></p></li>
<li><p><xref href="GUID-1FDBA8F6-D1CC-3AE5-AF48-1256D50C5A4F.dita"><apiname>CMsvOperationWait </apiname></xref></p></li>
<li><p><xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita"><apiname>RSendAsMessage </apiname></xref></p></li>
</ul></section>
<section id="GUID-13FDF5EE-00C2-54D4-AF6C-41E3DBDC2B93"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian
build process</xref> describes how to build an application. </p> <p>The SendAs example builds an executable called <filepath>SendAs2Example.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\</filepath> <i>&lt;build_variant&gt;</i> for CodeWarrior). After launching the
executable, depending on the emulator you are using, you may need
to task away from the app launcher/shell screen to view the console. </p> </section>
<section id="GUID-E9152EC2-A404-549C-B7CA-25CAC97BA686"><title>See
also</title> <p>To create advanced applications using the SendAs API
refer to the complete <xref href="GUID-F7598A84-9736-5310-AAA4-5BCC4BE46C16.dita"> SendAs </xref> API
reference documentation, which details all the features of the API. </p> </section>
</conbody></concept>