Solved

javamail api to access public/shared folders

Posted on 2002-03-14
3
1,443 Views
Last Modified: 2013-11-24
I am new to javamail api.  I tried the following code and I can get all the sub-folders in my email account.

My question is how to access public folder, and other user's shared folder (all in the same MS Exchange Server).
I can't find anyway to go "up" beyound my email account.

Please help.

Joey :(

String host = "machineHostName";
String username = "donmainName\\userName";
String password = "userPassword";


try {
  Properties props = new Properties();
  Javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props, null);
  Store store = mailSession.getStore("imap");
  store.connect(host, username, password);
  Folder folder = store.getDefaultFolder();
  Folder[] folders = folder.list();
  for(int i=0;i<folders.length; i++) {
     out.println(folders[i].getName() + "<br>");
  }
  store.close();
}
catch(Exception e) {
    out.println(e);
}
0
Comment
Question by:joey9394
3 Comments
 

Accepted Solution

by:
brian1452 earned 100 total points
ID: 7426511
Once you have connected to the store, I think that you could try the following code:

Folder publicFolder = store.getFolder("Public Folders/");
Folder[] folders = publicFolder.list("*");  

I can't take credit for this, I found in on jGuru.com
http://www.jguru.com/faq/view.jsp?EID=343803

One question I had for you is did you run into any problems getting calling store.connect(<host>, <user>, <pw)?  I have tried specifing user as "MyDomain\\NtLogin"
and as "MyDomain\\NtLogin\\FirstName LastName".  

I keep getting a time out error.  
Any help with this would be great.
Here is my question so you can get some points if you can answer it:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/qManageQuestion.jsp?qid=20393907

Thanks




0
 
LVL 9

Expert Comment

by:Venci75
ID: 7901748
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: brian1452
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7962601
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
ejb on wildfly 5 45
jmss example java 2 31
Why doesn't this text field show up on my Applet frame? 2 28
Github api to fetch the number of collaborators in a git repo 1 27
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

763 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