Removing attachments from messages

The messaging framework allows you to remove attachments from messages.

Context

Attachments to a message may be removed.

Steps

  1. Get the details of the message to which you want to add an attachment using CMsvEntry::EditStoreL().

    This function returns CMsvStore in writable mode.
  2. Get an MMsvAttachmentManager attachment manager for the message entry, using CMsvStore::AttachmentManagerL().

  3. Remove an attachment using the MMsvAttachmentManager::RemoveAttachmentL() function.

    Example:

    void CFoo::RemoveAttachL(TInt aNum)
        {
        ...
        
        TRequestStatus status;
        
        // Remove attachment with index aNum
        attManager.RemoveAttachmentL(aNum, status);
        
        // Wait for request to complete
        User::WaitForRequest(status);
        
        ...
        }

Related concepts