Sending an File Attachment using CSendUI

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: bharatuppal (13 Jul 2007)
Last edited: hamishwillee (03 Feb 2012)

The Following code shows the usage of Sending a file as an attachment via the list of all the connectivity services supported the devices. While using this code you will get the list of Connection Services you can use to send the attachement for example Bluetooth, Email, IRDA etc.


#include <e32base.h>  // TUid
#include <senduiconsts.h>
#include <senduiconsts.h>
#include <tsendingcapabilities.h>
#include <cmessagedata.h>
#include <sendui.h>

Link against:

LIBRARY sendui.lib

Required capabilities:

CAPABILITY LocalServices NetworkServices ReadDeviceData WriteDeviceData ReadUserData WriteUserData

Define in your class header:

CMessageData* iMessageData;
CSendUi* iSendUi;

Initialize these fields in ConstructL:

iSendUi = CSendUi::NewL();
iMessageData = CMessageData::NewL();

Main method for sending:

void CMyClass::CreateAndSendAttachmentL(const TDesC& aFileName)
TUid serviceUid = iSendUi->ShowSendQueryL();
if(serviceUid.iUid != 0)
TSendingCapabilities capa;
iSendUi->ServiceCapabilitiesL(serviceUid, capa);
iSendUi->CreateAndSendMessageL(serviceUid, iMessageData);

Delete data in destructor:

delete iSendUi;
delete iMessageData;

You can achieve the above functionality using RSendAsMessage

This page was last modified on 3 February 2012, at 05:20.
38 page views in the last 30 days.