Solved

javamail api to access public/shared folders

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 65
JAVA part two 5 55
How to increase Spring boot/Tomcat max file upload size 2 16
arguments to jar 5 6
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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:

947 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

19 Experts available now in Live!

Get 1:1 Help Now