Sending an File Attachment using CSendUI
Article Metadata
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.
Headers:
#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);
iMessageData->AppendAttachmentL(aFileName);
iSendUi->CreateAndSendMessageL(serviceUid, iMessageData);
}
}
Delete data in destructor:
delete iSendUi;
delete iMessageData;
You can achieve the above functionality using RSendAsMessage


14 Sep
2009
This small code snippet demonstrates how to use standard S60 approach for sending data. It allows you to select particular channel (bluetooth, email, irda, etc) and to send file via selected channel. One important note: this approach requires important capabilities, so it is impossible to use self-signed procedure.
This example works fine on Nokia N96.
28 Sep
2009
CSendUI is useful class to send files or data via available services. Sending services can be based on the MTM or ECom architecture. You can send data or files using available service like SMS, MMS, email, irda and bluetooth.
Usually CSendUI require LocalServices, NetworkServices, ReadDeviceData, WriteDeviceData, ReadUserData, andWriteUserData capabilities, but if DRM protected files are being sent via MMS, then DRM capability is required in application.
This article describes how to send file using available services, which helps begginers as well as experienced developers. Also note that you have to use CSendAppUi API for developing application for 2nd edition devices.