diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-A09AFA5C-7B2A-503C-A218-987F2F9BF7B8.dita --- a/Symbian3/PDK/Source/GUID-A09AFA5C-7B2A-503C-A218-987F2F9BF7B8.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-A09AFA5C-7B2A-503C-A218-987F2F9BF7B8.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,105 +1,105 @@ - - - - - -Adding -attachments to messagesThe messaging framework allows you to add attachments to messages. -

A message attachment, -once it has been created, must be added to its message in a separate procedure -explained in this document.

- - -Create an active object implementation. All the MMsvAttachmentManager functions -that modify attachments for an entry are asynchronous, so a request must be -called with an active object implementation. -//* Active object request function to add an attachment. -Arguments: -aEntry - entry to make attachment for -aAttachPath - path of file to attach -aSize - size of attachment in bytes -*/ - -void CFoo::AttachFileL(CMsvEntry& aEntry, const TFileName& aAttachPath, TInt aSize) - { -... - // Wait for request to complete - User::WaitForRequest(status); - - CleanupStack::PopAndDestroy(store); - } - - - -Get the details -of the message to which you want to add an attachment using CMsvEntry::EditStoreL(). -This function returns CMsvStore in writable mode. - // Get store - CMsvStore* store = aEntry.EditStoreL(); - CleanupStack::PushL(store); - - -Get an MMsvAttachmentManager attachment -manager for the message entry, using CMsvStore::AttachmentManagerL(). - // Get attachment manager from the entry's store - MMsvAttachmentManager& attManager = store->AttachmentManagerL(); - - - -Create a new attachment attributes object using the CMsvAttachment::NewL() function. - // Create a new attachment attributes object - CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); - CleanupStack::PushL(attachment); - - - -Set the attachments name and size attributes using the functions of -the CMsvAttachment class. - // Set the attachment name and size attributes - TParse fparse; - User::LeaveIfError(fparse.Set(aAttachPath,NULL,NULL)); - attachment->SetAttachmentNameL(fparse.NameAndExt()); - attachment->SetSize(aSize); - - - -Add the attachment using any of the following functions: - - - -For copied attachments, use the MMsvAttachmentManager::AddAttachmentL() function. - - -For linked attachments, use the MMsvAttachmentManager::AddLinkedAttachmentL() function. - - - Note: For OBEX MTM, to add headers to an attachment, use the CObexHeaderList::ExportToAttachmentL() function. -Headers can be retrieved using the CObexHeaderList::ImportFromAttachmentL() function. - TRequestStatus status; - - // Ownership of attachment will transfer to attachManager - CleanupStack::Pop(attachment); - // Add the attachment - attManager.AddAttachmentL(aAttachPath, attachment, status); - - - -Commit the store. - - -

You now have an -attachment added to its message.

-

You can now retrieve -and modify the message attachment.

-
-Attachment -Tutorial -Messaging -Framework Overview + + + + + +Adding +attachments to messagesThe messaging framework allows you to add attachments to messages. +

A message attachment, +once it has been created, must be added to its message in a separate procedure +explained in this document.

+ + +Create an active object implementation. All the MMsvAttachmentManager functions +that modify attachments for an entry are asynchronous, so a request must be +called with an active object implementation. +//* Active object request function to add an attachment. +Arguments: +aEntry - entry to make attachment for +aAttachPath - path of file to attach +aSize - size of attachment in bytes +*/ + +void CFoo::AttachFileL(CMsvEntry& aEntry, const TFileName& aAttachPath, TInt aSize) + { +... + // Wait for request to complete + User::WaitForRequest(status); + + CleanupStack::PopAndDestroy(store); + } + + + +Get the details +of the message to which you want to add an attachment using CMsvEntry::EditStoreL(). +This function returns CMsvStore in writable mode. + // Get store + CMsvStore* store = aEntry.EditStoreL(); + CleanupStack::PushL(store); + + +Get an MMsvAttachmentManager attachment +manager for the message entry, using CMsvStore::AttachmentManagerL(). + // Get attachment manager from the entry's store + MMsvAttachmentManager& attManager = store->AttachmentManagerL(); + + + +Create a new attachment attributes object using the CMsvAttachment::NewL() function. + // Create a new attachment attributes object + CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); + CleanupStack::PushL(attachment); + + + +Set the attachments name and size attributes using the functions of +the CMsvAttachment class. + // Set the attachment name and size attributes + TParse fparse; + User::LeaveIfError(fparse.Set(aAttachPath,NULL,NULL)); + attachment->SetAttachmentNameL(fparse.NameAndExt()); + attachment->SetSize(aSize); + + + +Add the attachment using any of the following functions: + + + +For copied attachments, use the MMsvAttachmentManager::AddAttachmentL() function. + + +For linked attachments, use the MMsvAttachmentManager::AddLinkedAttachmentL() function. + + + Note: For OBEX MTM, to add headers to an attachment, use the CObexHeaderList::ExportToAttachmentL() function. +Headers can be retrieved using the CObexHeaderList::ImportFromAttachmentL() function. + TRequestStatus status; + + // Ownership of attachment will transfer to attachManager + CleanupStack::Pop(attachment); + // Add the attachment + attManager.AddAttachmentL(aAttachPath, attachment, status); + + + +Commit the store. + + +

You now have an +attachment added to its message.

+

You can now retrieve +and modify the message attachment.

+
+Attachment +Tutorial +Messaging +Framework Overview
\ No newline at end of file