?
Solved

Is this possible ?

Posted on 2002-07-16
4
Medium Priority
?
196 Views
Last Modified: 2013-11-24
Is this possible to access the Exchange server's Global address list using JNDI ?

0
Comment
Question by:cstsang
[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
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 7158991
AFAIK, yes. You might be able to customise the following:

import javax.naming.*;
 import javax.naming.directory.*;
 import java.util.Hashtable;
 
 public class Search {
   public static void printSearchEnumeration(NamingEnumeration enum){
     try {
       while (enum.hasMore()) {
         SearchResult sr = (SearchResult)enum.next();
      System.out.println(">>>" + sr.getName());
      GetattrsAll.printAttrs(sr.getAttributes());
       }
      } catch (NamingException e) {
        e.printStackTrace();
      }
   }
   
   
   public static void main(String[] args) {
     // rechargement de l'environnement de l'initialisation du context
     Hashtable env = new Hashtable(11);
     env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
     env.put(Context.PROVIDER_URL, "ldap://digactive:389/dc=intraucad,dc=ucad,dc=sn");
     env.put(Context.SECURITY_AUTHENTICATION,"simple");
     env.put(Context.SECURITY_PRINCIPAL,"cn=administrateur,cn=users,dc=intraucad,dc=ucad,dc=sn");
     // specify the username
     env.put(Context.SECURITY_CREDENTIALS,"digactive");
     // specify the password
     try {
       // Crer le context initial
       DirContext ctx = new InitialDirContext(env);
       // Specifie les ids des attributs à retourner
       String[] attrIDs = {"sn", "telephonenumber", "mail"};
       // Specifie les attributs que doit avoir l'objet
       // cherché ici l'attribut ("sn")
       // avec la valeur "titi"
       // et un attribut "mail" .
       Attributes matchAttrs = new BasicAttributes(true);
       // ignore case
       matchAttrs.put(new BasicAttribute("sn", "titi"));
       matchAttrs.put(new BasicAttribute("mail"));
       // Cherche parmi les objets de "toto" ceux ayant de tels attribut
       NamingEnumeration answer = ctx.search( "ou=toto",matchAttrs, attrIDs);
       // Imprimer la reponse
       printSearchEnumeration(answer);
       // Clore le context ctx.close();
      } catch (Exception e) { e.printStackTrace();
    }
  }
}
0
 
LVL 7

Author Comment

by:cstsang
ID: 7159017
In fact, I need to get all the email address and user name from the global address list.
0
 
LVL 7

Author Comment

by:cstsang
ID: 7266137
I have tried your program, it doesn't work.
By the way, I haven't told you that I am using exchange 5.5 not 2000.That why your program cannot work.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 240 total points
ID: 7266595
The program's just a demo of using JNDI-LDAP. Since Exchange 5.5 supports LDAP, you should be able to adapt it to look at the global address book.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

765 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