Problem Extracting SMS Address

Login to reply to this topic.
Tue, 2006-04-04 11:13
Joined: 2006-03-26
Forum posts: 8
Hi!

Please help!

I'm trying to extract the inbox SMS address in iMsgNumber but I don't know what is the problem because the length of the iMsgNumber is 0, and all my inbox messages have addresses. This is my code:

   // Create object defining grouping, ordering and if invisible
   // entries are included into folder entry to be retrieved
   TMsvSelectionOrdering order(KMsvNoGrouping, EMsvSortByNone,ETrue);
   // Retrieve entry representing Inbox
   CMsvEntry* inboxEntry = CMsvEntry::NewL(*iSession,KMsvGlobalInBoxIndexEntryId, order);
   //push the entry to CleanupStack
   CleanupStack::PushL(inboxEntry);
   
   // Get list of message entries in Inbox, folders are not included
   CMsvEntrySelection* selection =inboxEntry->ChildrenWithTypeL(KUidMsvMessageEntry);
   //push the selection to CleanupStack
   CleanupStack::PushL(selection);
   
   // Count the messages
   const TInt count(selection->Count());
   //aici am modificat
   TInt iOKBody;
   TInt iOKNumber;
   for (TInt i = 0; i < count; i++)
      {
         // access message entry
         TMsvEntry messageEntry;
         TMsvId owningServiceId;
         //if there is an error Leave
         User::LeaveIfError(iSession->GetEntry((*selection)[count-1],owningServiceId, messageEntry));
         // size of the entry is in TMsvEntry::iSize

         TBuf<KSMSBodyLength> iMsgBody(messageEntry.iDescription);
//message address
         iSmsMtm->SwitchCurrentEntryL( messageEntry.Id() );   
   
         CSmsClientMtm* aSmsMtm = STATIC_CAST(CSmsClientMtm*, iSmsMtm);           
         CSmsHeader& hdr = aSmsMtm->SmsHeader();             
         TBuf<KSMSPhoneNumberLength> iMsgNumber = hdr.FromAddress();
//end end message address

         
   }
      

Tue, 2006-04-04 13:44
Joined: 2006-02-09
Forum posts: 7
Re: Problem Extracting SMS Address

Hi try this

iSmsMtm->SwitchCurrentEntryL( aFolderID );
CMsvEntry& entry = iSmsMtm->Entry();

CMsvEntrySelection* entries = entry.ChildrenWithMtmL(KUidMsgTypeSMS);

   CDesCArrayFlat* arrayAddr = new (ELeave) CDesCArrayFlat(10);
   CDesCArrayFlat* arrayMsgBody = new (ELeave) CDesCArrayFlat(70);

   iIdArray = new (ELeave) RArray<TMsvId>;



for (TInt i = 0; i < entries->Count(); i++ )
{
   TBuf<KMessageBodySize> body;
   TBuf<KMessageAddressLength> address;

if ( GetMessageIndexBodyTextL( (*entries)[i], body ) ) //
{
      iIdArray->Append( (*entries)[i] );
      arrayMsgBody->AppendL ( body );   

      // Recipient address
   GetMessageAddressL( (*entries)[i], address );
   arrayAddr->AppendL ( address );
}
         
}
Fri, 2006-04-07 09:07
Joined: 2006-03-26
Forum posts: 8
Re: Problem Extracting SMS Address
Hi !

I have one more question:

Where can I find references on this two:

GetMessageIndexBodyTextL,GetMessageAddressL
  • Login to reply to this topic.