Solved

javamail api to access public/shared folders

Posted on 2002-03-14
3
1,464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:
Suggested Courses

623 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