Symbian3/SDK/Source/GUID-382B8A9D-9D10-54CD-91A6-B9E7A2477662.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
child 2 ebc84c812384
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-423E2320-FB34-3249-80D9-9AA62C9DDF60"><apiname>CMsvSession::OpenSyncL()</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-139272C1-EF75-3BD9-AB67-3573C5C2D68C"><apiname>CMsvEntry::SetEntryL()</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-80D240A0-5896-35A3-AADD-830046776D35"><apiname>CMsvEntry::ChildrenL()</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-2B52A16E-FD71-3E9E-89A1-E154F01F5A59"><apiname>RSendAsMessage::CreateL()</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-6823DF51-D9D6-384C-9FE3-C00D30D3B232"><apiname>RSendAsMessage::SetBodyTextL()</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-9F433FF9-0276-34B0-ADF3-F332E90A9248"><apiname>RSendAsMessage::AddRecipientL()</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><title>Class summary</title><p> The SendAs v2 example application
uses the following classes:</p><p><xref href="GUID-85BBE389-81F7-3E2F-A789-446D9BE2CC49.dita"><apiname>CMsvEntry </apiname></xref><xref href="GUID-B36289AC-769F-3A83-BADB-AE0568E97581.dita"><apiname>MMsvEntryObserver </apiname></xref><xref href="GUID-2DA04D96-F0AD-3FDC-9E36-1C27D889AF4B.dita"><apiname>CMsvSession </apiname></xref><xref href="GUID-E1699CAB-423D-3AFA-BE77-3AFF38886EA3.dita"><apiname>RSendAs </apiname></xref><xref href="GUID-CB2BB982-F91D-3E06-8D66-56731AA60EB8.dita"><apiname>CSendAsMessageTypes </apiname></xref><xref href="GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4.dita"><apiname>CSendAsAccounts </apiname></xref> <xref href="GUID-90C4FDEE-3E4D-32B3-85E1-52C157AC4AC4.dita"><apiname>CSendAsAccounts </apiname></xref> <xref href="GUID-1FDBA8F6-D1CC-3AE5-AF48-1256D50C5A4F.dita"><apiname>CMsvOperationWait </apiname></xref><xref href="GUID-4499491F-FA1A-38E1-BB13-1AB184A31DA6.dita"><apiname> RSendAsMessage </apiname></xref></p></section>
<section id="GUID-13FDF5EE-00C2-54D4-AF6C-41E3DBDC2B93"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian OS 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>