Welcome!

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

Java Development

Reply
Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified
Accepted Solution

how to retrieve mail sub folders

We are on a coporate BES account and I setup my Outlook with subfolders and it shows on my device as follows:

 

Mailbox - Me
Inbox
-My Coworkers
------Coworker A
------Coworker B
-Our Customers
------Customer A
------Customer B
-Our Suppliers
------Suppliers A
------Suppliers B

 

works great but now i try to write an application that has the need to pull up incoming mail but can only read the [Inbox] as everything was automatically moved to their appropriate folders.

 

I saw some examples and tried it but can't seem to list the incoming mail in sub folders.

 

Do I have to know each folder's name to view it? or is there a method for just reading all folders with incoming mail.

 

 

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: how to retrieve mail sub folders

ipcTony,

 

Did you read the KB article? Seems to work for me:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800698/What_Is...

 

 

Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: how to retrieve mail sub folders

[ Edited ]

yes i have but since this is my first attempt to work with mails I was not sure about the folder listener part. So from what it says I need to attach a listener to each folder. but does my app have to be running to actually receive these notices. or my i only to be concerned about the "Search recursively for INBOX folders" part of the article?

 

I think i got. tried some things and getting lower folder information now

Message Edited by ipcTony on 10-10-2008 07:55 PM
Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: how to retrieve mail sub folders

need help with deciphering this piece of code:

 

public void recurse(Folder f)
{
   if ( f.getType() == Folder.INBOX )
   {
       f.addFolderListener(this);
       listFoldersItems(f); // test 1
   }
   Folder[] farray = f.list();
   for (int fcnt = farray.length - 1; fcnt >= 0; --fcnt)
   {
       recurse(farray[fcnt]);
       listFoldersItems(farray[fcnt]);     // test 2

  }
}

 

When running this code with [test 2] enabled I get every email that was received on my device. but if [test 1] is enabled I get 1/4 or less for the last 2 months.

 

The if statements checks the folder is of type INBOX. Does this mean that because I orginally setup sub folders that these sub folders even tho they received the new emails are not considered INBOX?

 

And if I need to access all incoming mail then i should be fine with loading my listfield using option test 2?

Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: how to retrieve mail sub folders

[ Edited ]

is there a way to determine which level a folder is? for example I'm trying to use a treefield to recreate the folder tree in the mail applicaton and I need to know which folder level the "My Coworkers" folder is.

 

Mailbox - Me
--------My Coworkers
--------------Coworker A
--------------Coworker B

 

When i try to get Type its the same as:

 

--------My Coworkers = OTHERS
--------------Coworker A = OTHERS
--------------Coworker B  = OTHERS

 

Also is there a unique ID for each folder? I'm getting multiple Inbox and and other folders and would like to retrieve the message from them.

 

thanks.

Message Edited by ipcTony on 10-11-2008 02:07 PM
Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: how to retrieve mail sub folders

figured everything out. had to do some strange stuff to get it working right up to retrievingthe messages in sub folders but its working.