当前位置: 代码迷 >> Exchange >> JAVA 联接 Exchange服务
  详细解决方案

JAVA 联接 Exchange服务

热度:10451   发布时间:2013-02-26 00:00:00.0
JAVA 连接 Exchange服务
联合经济委员会提供了一个纯Java API来访问Microsoft Exchange Server。有了它,您可以访问和处理电子邮件,日历,联系人,并在Exchange服务器任务。它支持2种执照- 1)非利润,学术机构,以及个人,和2)商业。欲了解更多信息请参阅:http://javaexchangeconnector.googlepages.com这是google快照,里面有不错的事例。简单的连接
String _exchangeHost = "192.168.0.29";		String _applicationUserAccountName = "beijing";		String _applicationUserPassword = "123456";		String _prefix  = "Exchange";		boolean _useSSL = false;		String _mailboxName = "beijing";	    ExchangeConnectorFactory factory = new ExchangeConnectorFactory("D:/web/www/eclipse-workspace/java_exchange/WEB-INF/lib");//        ExchangeConnectorInterface connector = null;        factory.setPrivkeystoreFullPath("D:/web/www/eclipse-workspace/java_exchange/WEB-INF/lib/privkeystore");//	    ExchangeConnectorFactory factory = new ExchangeConnectorFactory();        ExchangeConnectorInterface connector = null;        connector = factory.createExchangeConnector(_exchangeHost,                _applicationUserAccountName,                _applicationUserPassword,                _prefix, _useSSL, _mailboxName); System.out.println("connector.getDraftsFolderName():"+connector.getDraftsFolderName());        //connector.getEmailFolderName();        System.out.println("connector.getEmailFolderName():"+connector.getEmailFolderName());        try {//        	connector.getFolders("http://192.168.0.29/exchange/beijing/%E5%8F%91%E4%BB%B6%E7%AE%B1/");//http://192.168.0.29/exchange/liuwg/%E6%94%B6%E4%BB%B6%E7%AE%B1/			//草稿 %E8%8D%89%E7%A8%BF        	//收件箱 %E6%94%B6%E4%BB%B6%E7%AE%B1        	//发件箱 %E5%8F%91%E4%BB%B6%E7%AE%B1        	//已发送邮件 %E5%B7%B2%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6        	        	connector.setEmailFolderName("%E5%B7%B2%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6");        	ArrayList list = connector.getEmails();			System.out.println("########################## Email 有"+list.size()+"条");						for(int i=0; i<list.size(); i++){							ExchangeEmailDTO email = (ExchangeEmailDTO) list.get(i);	            System.out.println("email1.getUniqueIdForUrl(): " +	                               email.getUniqueIdForUrl());	            System.out.println("email1.getSubject(): " +	                               email.getSubject());//	            System.out.println("email1.getBody(): " +//	                               email.getBody());	            System.out.println("email1.getDateReceived(): " +	                               email.getDateReceived());	            System.out.println("email1.getTo(): " +	                               email.getTo());	            System.out.println("email1.getFrom(): " +	                               email.getFrom());	            System.out.println("email1.isRead: " +	                               email.isRead());	            System.out.println("email1.getCc: " +	                               email.getCc());	            System.out.println("email1.getBcc: " +	                               email.getBcc());	            System.out.println("----------------------------------------------------------------");			}		} catch (ExchangeGeneralException e) {			// TODO Auto-generated catch block			e.printStackTrace();		}
.这个网站上的事例需要许可证,时间长了可能过期,你要上网问这个邮箱jonathan.sanders@netcompss.com
索取key文件,老外叫Jonathan Sanders,人挺好的

1 楼 phoenixLotus 2010-09-21  
最近有项目要做与exchange的集成,单点登录等等。没免费的,可怎么是好啊。
不知道楼主有好一点的解决方案可以帮我提供下没。
谢谢。
2 楼 ydsakyclguozi 2010-11-25  
    
3 楼 ch21 2010-12-08  
我最近也在用jec,可是总是出错,
Exception in thread "main" jec.framework.exchange.exception.TrialLicenseException: Can't locate Trial License file. contact evaluation@netcompss.com to get your evaluation license.
at jec.utils.b.a(Unknown Source)
at jec.utils.b.a(Unknown Source)
at jec.ExchangeConnectorFactory.createExchangeConnector(Unknown Source)
at JECExamples.getContactsExample(JECExamples.java:406)
at JECExamples.main(JECExamples.java:141)

我已经将jeclicense他用buildpath设置了.

Can you help me?
4 楼 ch21 2010-12-08  
I have done!

:)
5 楼 ch21 2010-12-10  
ERROR [jec.utils.AppLogger] got HttpException in setHttpURL
jec.framework.exchange.exception.AuthenticationException
        at jec.framework.a.d.if(Unknown Source)
        at jec.framework.a.d.a(Unknown Source)
        at jec.a.a.a.if(Unknown Source)
        at jec.a.a.a.a(Unknown Source)
        at jec.ExchangeConnector.getContacts(Unknown Source)
        at JECExamples.getContactsExample(JECExamples.java:423)
        at JECExamples.main(JECExamples.java:142)

The Connection with exchange 2003 is Ok, but I can do nothing with Exchange.

你能帮我一下吗
6 楼 mzba520 2011-03-04  
完全看不懂啊
  相关解决方案