How to delete the MMs & SMS

/*
Delete messages from Messaging Folders
[edit] Inbox
[edit] Outbox
[edit] Draft
[edit] Sent Item

    * Following code snippet illustrates deleting messages from Inbox Folder. KMsvGlobalInBoxIndexEntryId is used.
    * To delete messages from Outbox Folder, use KMsvGlobalOutBoxIndexEntryId
    * To delete messages from Draft Folder, use KMsvDraftEntryId
    * To delete messages from Sent Item Folder, use KMsvSentEntryId
    */


void CMMSCreateModel::DeleteMMS()
    {
    TMsvSelectionOrdering sort;
    sort.SetShowInvisibleEntries(ETrue);
    CMsvEntry* OutBoxEntry = CMsvEntry::NewL(*iMsvSession,
            KMsvSentEntryId/*KMsvGlobalOutBoxIndexEntryId*/, TMsvSelectionOrdering());
    CleanupStack::PushL(OutBoxEntry);
   
    //
    CMsvEntrySelection* entries = OutBoxEntry->ChildrenL();
    CleanupStack::PushL(entries);
    TInt msgCount = entries->Count();
    TInt i;
    for( i=0;i<msgCount; i++)
        {
        TMsvId entryID = entries->At(i);
        iSmsClientMtm->SwitchCurrentEntryL(entryID);
        CMsvEntry* entry = iMsvSession->GetEntryL((*entries)[i]);
        CleanupStack::PushL(entry);
        //
        entry->DeleteL(entryID);
        CleanupStack::PopAndDestroy(entry);
        }
    CleanupStack::PopAndDestroy(entries);
    CleanupStack::PopAndDestroy(OutBoxEntry);
   
    }

also this is linked http://wiki.forum.nokia.com/index.php/SMS_Operations

你可能感兴趣的:(How to delete the MMs & SMS)