exchangewebservices - Java EWS API - reading non default mailbox -


i read non default mailbox on exchange server java ews api, wrong code. here excerpt relevant part:

exchangeservice service = new exchangeservice(exchangeversion.exchange2007_sp1); exchangecredentials credentials = new webcredentials("<user>", "<pass>"); service.setcredentials(credentials); service.seturl(new uri("https://<url>/ews/exchange.asmx")); itemview iview = new itemview(3); mailbox mb = new mailbox(); mb.setaddress("<mailbox_address>"); folderid folderid = new folderid(wellknownfoldername.root, mb); finditemsresults<item> findresults = service.finditems(folderid, iview); 

and error message is:

exception in thread "main" microsoft.exchange.webservices.data.ewshttpexception: connection not established     @ microsoft.exchange.webservices.data.httpclientwebrequest.throwifconnisnull(unknown source)     @ microsoft.exchange.webservices.data.httpclientwebrequest.getresponseheaders(unknown source)     @ microsoft.exchange.webservices.data.exchangeservicebase.processhttpresponseheaders(unknown source)     @ microsoft.exchange.webservices.data.simpleservicerequestbase.internalexecute(unknown source)     @ microsoft.exchange.webservices.data.multiresponseservicerequest.execute(unknown source)     @ microsoft.exchange.webservices.data.exchangeservice.finditems(unknown source)     @ microsoft.exchange.webservices.data.exchangeservice.finditems(unknown source) 

btw. able read default mailbox, send emails, etc...

could please advise? in advance!

i believe trying access 1 mailbox, using credentials of account. can solved impersonation.

in newer versions of ews can either solved in ad on exchange server or by programmatically setting connectingsid property. bank on second 1 , make primary smtp address configurable different environments.

here code example using ews 2010 in c#, might have use setcredentials(credentials) instead , on:

code example ews 2010

exchangeservicebinding binding = new exchangeservicebinding(); // use class instead of exchangeservice (!) binding.credentials = credentials;   // etc      binding.exchangeimpersonation = new exchangeimpersonationtype(); binding.exchangeimpersonation.connectingsid = new connectingsidtype(); binding.exchangeimpersonation.connectingsid.primarysmtpaddress = "<mailbox_address>"; 

documentation ews 2007

it seems should available in ews 2007 sp1, according this article. please note, article, that:

you have set rights “ms-exch-epi-impersonation” must on client access server service account impersonation. additionally service account have have “ms-exch-epi-may-impersonate” right granted on each mailbox impersonate. right inherited down mailboxes if set @ store, storage group, server, or organizational level.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -