dcsimg
How can i modify an entry in Microsoft Exchange 5.5
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, October 24, 2002 02:16 AM

I'm making an interface between our database and our Microsoft Exchange 5.5. My objetive is to change the Exchange's data automatically. I'm new with jndi. I can read from the directory but when i go to modify any data, java returns me this exception: javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'uid=EDUB, ou=my_site, o=my_organization' The uid, site, and organization are correct. What's happening? The program's code is the next one: try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://my_exch_serv:389&q   More>>

I'm making an interface between our database and our Microsoft Exchange 5.5. My objetive is to change the Exchange's data automatically.


I'm new with jndi. I can read from the directory but when i go to modify any data, java returns me this exception:



javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'uid=EDUB, ou=my_site, o=my_organization'


The uid, site, and organization are correct. What's happening?


The program's code is the next one:


			
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://my_exch_serv:389");

String pClave= new String("uid=EDUB, ou=my_site, o=my_org");
ModificationItem[] pMod= new ModificationItem[1];
Attribute modTelefono = new BasicAttribute("telephonenumber", "945144098");
pMod[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, modTelefono);


DirContext ctx = new InitialDirContext(env);
ctx.modifyAttributes(pClave, pMod);
} catch (Exception e) {
e.printStackTrace();
}



Thank you very much in advance for your interest.



Greetings!!!

   <<Less

Re: How can i modify an entry in Microsoft Exchange 5.5

Posted By:   Anonymous  
Posted On:   Thursday, October 24, 2002 03:16 AM

This is an autoanswer.



I was wrong with Exchange's authentication. I had to autheticate at exchange server. I had to pass a user with administrator permissions. That was my principal error.



Other problem was the url that i was using to indentify the entry i would want to change. I am using "uid=user_name" but i had to use "cn=user_name, cn=Recipients".



Well, the correct code i am using in this moments is below:



try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://my_exchange_server:389");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=admon_username, ou=my_site, o=my_org");
env.put(Context.SECURITY_CREDENTIALS, "admon_password");

String pClave= new String("cn=user_to_change, cn=Recipients, ou=my_site, o=my_org");
ModificationItem[] pMod= new ModificationItem[1];
Attribute modTelefono = new BasicAttribute("telephonenumber", "945144098");
pMod[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, modTelefono);


DirContext ctx = new InitialDirContext(env);
ctx.modifyAttributes(pClave, pMod);
} catch (Exception e) {
e.printStackTrace();
}




Hope this answer was usefull to someone else.


Greetings!!

About | Sitemap | Contact