Am totally unaware about this area, how Microsoft exchange server works. Just wanted to know can we integrate a exchange server using Apex Code? Is it is possible to call the exchange server from a batch/scheduled process to bring down all the emails?

If yes any code sample to connect SF to Exhange/IMAP/SMTP using Apex code?


It depends on what type of endpoints are available to interact with an Exchange server. I am not super familiar with Exchange, so I can't really give you specifics on that.

Depending on what you want to do, you may want to look into preexisting solutions:

Take a look around the AppExchange as well.

For full disclosure, I have not and do not use any of the products I listed. They are listed just to give you an idea of what is available. I have no experience with them and highly recommend doing research on them before picking a solution if that is the route you wish to take.

  • Thanks for the suggestions. But I want to know how we can do this using APEX code, am not getting anything about the endpoint or webservice or whatever they are called. Searched the web, but no luck! :( – Avidev9 Mar 8 '13 at 18:41

Salesforce Apex would only be able to integrate with Exchange through a webservice. (http://msdn.microsoft.com/en-us/library/exchange/dd877045(v=exchg.140).aspx)

As far as how steps on how this would be done, I dont know of any public resource that has provided this.

you could start by trying to convert one of the exchange wsdl files into an apex class.

inbound options:
- create apex webservice, code exchange to push mail to the webservice

outbound options:
- generate wsdl based apex code to callout to exchange
- create a third party service that communicates between exchange and salesforce

  • thanks for the link but the wsdl doesnt seem to be compatible with salesforce :( – Avidev9 Mar 8 '13 at 21:33
  • @Aridev Probably you may wish to investigate why the parsing of WSDL failed .WSDL parsing in apex may fail due to multiple bindings ,unsupported data types ,multiple ports .So after all the analyses if still you are not able to parse the WSDL you can use HTTP callouts and construct XML using apex and send .May blow up if the request size is 3MB .As Jessey said researching appexchange products is a good approach too – Mohith Shrivastava Mar 9 '13 at 7:27
  • salesforce is pretty picky on what kind of WSDL it will accept. In the case where it will not parse I have been forced to create the soap envelopes by hand. – ebt Mar 11 '13 at 19:58

This answer is a bit delayed, but may still be useful.

I recommend you to consider the Agile GrinMark to Exchange Synchronizer (GESync). It provides server-side integration between Salesforce and Exchange. Integration includes two-way synchronization of Contacts, Accounts, Leads, Meetings, Calls, Tasks; Archiving emails; special scenarios to replicate and create items like Opportunities and Cases from your email client. This solution works without any client-side plugins. No need for additional configuration of standard mobile or desktop email clients (Outlook, Entourage, Mac Mail, iPhone, iPad, Android, Windows Phone, Blackberry, etc.).

Microsoft Exchange: 2007, 2010, 2013, Office365

Free trial version is available so you can try GESync before making a decision.


If what you need is one-time synchronization, then trial mode may be enough to get required results.

Best regards,
Denis Markovtsev
GrinMark CRM Integration Team


Tangentially related, but if you need to connect apex to exchange for data sync purposes, I would consider the existing tool, Salesforce For Outlook.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.