MMS: Feature is not supported (-5)
| Wed, 2006-08-30 13:44 | |
|
|
Hi, I tried to copy MMS message and all its attachments. My code is working but give me error message: "Feature is not supported (-5)" when open the message ![]() 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; } } Did I miss any step? I just want to read all attachments in the MMS message, do something then reassemble it. Btw, I use S60 2nd FP2. Any help or advice would be very much appreciated. Thanks. Halim I'm Java(nese). I live in Java. I speak Java. But I don't write my code in Java. |







Forum posts: 8
It seems that we can't create new entry in KMsvGlobalInboxIndexEntryId. If I create new entry under KMsvGlobalInboxIndexEntryId, I always get "Feature is not supported" error message
Also, smil attachment MUST be created with CreateTextAttachment() instead of CreateAttachment() or CreateAttachment2L(). Creating smil attachment with CreateAttachment or CreateAttachment2L will give "message is corrupted" error message. I can't find any explanation in SDK documentation, even on Google.
CMIIW.
Oh.. my dear Symbian, why are you so mysterious??
Regards,
Halim
I'm Java(nese). I live in Java. I speak Java. But I don't write my code in Java.