Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Regular Contributor
Posts: 58
Registered: ‎09-21-2010
My Device: Not Specified

Mulitple Accounts while retrieving messages

Hello All,

I am retrieving SMS programmetically.
First I retrieve the number of Accounts, then the number of folder in each account and number of messages in each account. Following is my code:

foreach (const Account &m_account, m_accountList) {
m_currentAccount = m_account;
fprintf(stderr,"Name: %s\n",m_currentAccount.displayName().toUtf8().constData());
QList<MessageFolder> folders = m_messageService->folders(m_currentAccount.id());
fprintf(stderr, "Folder Count : %d\n",folders.size());

MessageFilter filter;
const QList<Message> messages = m_messageService->messages(m_currentAccount.id(), filter);
fprintf(stderr, "Messages count : %d\n", messages.size());


Following is the output:
Debug: 199
Folder Count : 4
Messages Count : 0
Debug: 23
Folder Count : 0
Messages Count : 40
Debug: 23
Folder Count : 0
Messages Count : 40

I have 40 SMS (Incoming and Sent).
My question is:
1) Why it is showing 3 accounts.
2) Why there is no folder in 2nd and 3rd folder.

Any help is greatly appriciated.
Thanks in advance.

Manoj Kumar