Solved

javamail api to access public/shared folders

Posted on 2002-03-14
3
1,420 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven project error 5 54
JavaScript/Java - Changing an image background color 4 66
How to increase Spring boot/Tomcat max file upload size 2 64
servlet filter example 37 59
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

786 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