Solved

javamail api to access public/shared folders

Posted on 2002-03-14
3
1,409 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
Comment Utility
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
Comment Utility
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
Comment Utility
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now