attachments to messages
The messaging framework allows you to create attachments to be
added to messages.
messages are created as empty files before they are filled and added to a
Create an active object implementation. All the
that modify attachments for an entry are asynchronous, so a request must be
called with an active object implementation.
void CFoo::CreateAttachmentL(CMsvEntry& aEntry )
// Wait for request to complete
// Write to the file at the current offset within the file.
User::LeaveIfError(file.Write(_L8("text file as attachment")));
Get the details
of the message to which you want to add an attachment using
CMsvStore* store = aEntry.EditStoreL();
This function returns
in writable mode.
manager for the message entry, using
MMsvAttachmentManager& attManager = store->AttachmentManagerL();
Create a new attachment attributes object using the
// create a new attachment attributes object
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
// set attachment file name
Initialise a file handle.
// A file handle
Create a new attachment using the
function creates a new empty
attachment file and returns an open writable file handle to the empty attachment
file in the Message Store. You must pass an uninitialised file handle. The
file handle cannot be used until the asynchronous request completes successfully.
If the request is successful, the file handle is opened for writing.
// CreateAttachmentL API will return an open writable file handle
// to an empty attachment file in the message store.
attManager.CreateAttachmentL(KFileName, file, attachment, status);
Commit the store.
// Commit the store
The result of creating
an attachment is an empty file with a handle opened for writing.
You can now add
the attachment to a file and retrieve and modify it.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License