Hi,
I'm trying to copy a spesified MMS message in Inbox. It "works" but gives me error "Feature is not supported (-5)" while opening the message.
Wha's wrong with that code? Please help!Code:TInt CMmslController::CopyMsgL( TMsvId aMsgId ) { _LIT(KPhNumberFrom,"123456789"); _LIT(KPhNumberTo,"789012345"); // Message 1, source CMsvEntry* entry1 = iSession->GetEntryL( aMsgId ); CleanupStack::PushL(entry1); CMmsClientMtm* iClient1 = ( CMmsClientMtm * ) iMtmReg->NewMtmL( KUidMsgTypeMultimedia ); CleanupStack::PushL( iClient1 ); iClient1->SwitchCurrentEntryL( aMsgId ); iClient1->LoadMessageL(); // Message 2, destination CMsvEntry* entry2 = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId,TMsvSelectionOrdering()); CleanupStack::PushL( entry2 ); CMmsClientMtm* iClient2 = ( CMmsClientMtm * ) iMtmReg->NewMtmL( KUidMsgTypeMultimedia ); CleanupStack::PushL( iClient2 ); iClient2->SwitchCurrentEntryL(entry2->EntryId()); //CleanupStack::PopAndDestroy( entry2 ); iClient2->CreateMessageL( iClient2->DefaultSettingsL() ); iClient2->AddAddresseeL( KPhNumberTo ); iClient2->SetSenderL( KPhNumberFrom ); CMsvEntrySelection* aSelection = entry1->ChildrenL(); CleanupStack::PushL(aSelection); TFileName aPathName; TMsvId attId = KMsvNullIndexEntryId; _LIT8(KMimeSmil,"smil"); TPtrC8 ptrMime; TPtrC8 ptrCid; TMsvId rootId = KMsvNullIndexEntryId; TUint charset = 0; // get all attachments for(TInt i = aSelection->Count() - 1; i >= 0; --i) { iClient1->GetAttachmentPathL(aSelection->At(i),aPathName); if(ConeUtils::FileExists(aPathName)) { iClient2->CreateAttachment2L(attId,aPathName); ptrMime.Set(iClient1->AttachmentTypeL(aSelection->At(i))); iClient2->SetAttachmentTypeL(attId,ptrMime); charset = iClient1->AttachmentCharsetL(aSelection->At(i)); if(charset > 0) iClient2->SetAttachmentCharsetL(attId,charset); ptrCid.Set(iClient1->AttachmentCidL(aSelection->At(i))); iClient2->SetAttachmentCidL(attId,ptrCid); if((ptrMime.Length() > 0) && (ptrMime.Find(KMimeSmil) != KErrNotFound)) { iClient2->SetMessageRootL(attId); } } } if(rootId != KMsvNullIndexEntryId) { iClient2->SetMessageRootL(rootId); } else { iClient2->SetMessageRootL(attId); } iClient2->SaveMessageL(); // Validate the message TMsvPartList invalidParts = iClient2->ValidateMessage(KMsvMessagePartRecipient | KMsvMessagePartOriginator | KMsvMessagePartAttachments); TMsvEntry ent2 = iClient2->Entry().Entry(); // Set InPreparation to false ent2.SetInPreparation( EFalse ); ent2.SetVisible( ETrue ); ent2.iDescription.Set(iClient1->Entry().Entry().iDescription); ent2.SetPriority(iClient1->Entry().Entry().Priority()); ent2.iDate = iClient1->Entry().Entry().iDate; //ent2.iType = iClient1->Entry().Entry().iType; //ent2.iType = KUidMsvMessageEntryValue; iClient2->Entry().ChangeL( ent2 ); iClient2->SaveMessageL(); CleanupStack::PopAndDestroy(5); //ASSERT((invalidParts & KMsvMessagePartRecipient) <= 0); // Leave if one or more of the recipients is invalid if (invalidParts & KMsvMessagePartRecipient) { User::Leave(KErrCorrupt); return -1; } else { return 1; } }
Thanks.
Halim


Reply With Quote

