JavaMail API: Problems Getting Folder Names

Posted on 2009-04-22
Medium Priority
Last Modified: 2013-11-24
I am writing an application that can communicate with IMAP Servers and will allow the user to
access multiple folders on the server and access and manipulate the different messages that are in these folders.
 I am testing my application using my personal gmail account and am having difficulty getting the names of the folders in the account.  I know that there are 8 different folders in the account
but when I run the code below I get no folder names listed and the number of folders is stated as 1.  

Folder[] folders= store.getPersonalNamespaces();
for(int i=0; i<folders.length; i++)
          System.out.println("Folder #" + i + " is: " + folders[i].getName());
          System.out.println("The folder size is: " + folders.length);

Open in new window

Question by:Genus1
1 Comment
LVL 60

Accepted Solution

Kevin Cross earned 2000 total points
ID: 24209886
Folder[] folders = store.getDefaultFolder().list();

That works for me on AOL and GMAIL IMAP.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question