This repository was archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
lusis/Ruby-EWS
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
In this directory is some sample code I wrote for accessing a Microsoft Exchange Server via Exchange Web Services from ruby. Motivation I use mutt as my email client at work. It's fast and I like it. While I'm on the VPN, I can perform lookups just fine using the LDAP server on our AD servers. However my problem cropped up while I was flying back from Michigan on Airtran using the in-flight wireless. I was checking and sending email but the connection kept dropping and my VPN connection kept dying. We don't have LDAP exposed to the internet so I couldn't just stay off the VPN since I needed to lookup addresses. That's where this comes in. I needed to be able to perform lookups for email addresses while not on the VPN. Required gems: * soap4r * rubyntlm Files: * default.rb|defaultDriver.rb|defaultMappingRegistry.rb * - These files are generated by wsdl2ruby.rb from the soap4r gem. Don't mess with them if you expect this to work. Either Microsoft or wsdl2ruby are to blame but they had to be massaged to work. ewslookup.rb * - ruby class ews.rb - sample script to do a lookup against the exchange server Usage: If you want to use the sample script, feel free. Edit the username,password and endpoint variables at the top. Results are returned as an Array with an Array for each result/member. GAL Lookup ./ews.rb -g go will perform a lookup against the GAL and return and Contact, Mailbox or Distribution List that matches. Example Output: [["Bob Gold", "[email protected]", "Mailbox"], ["googleusers", "[email protected]", "PublicDL"], ["Golden Ticket Foods", "[email protected]", "Contact"]] DL Expansion ./ews.rb -l [email protected] ./ews.rb -l googleusers Will return a list of members in that Distribution List. The EWS call for distribution lists behaves differently than the lookup call. You MUST type the exact name or SMTP address associated with the DL. Example Output: [["Jack Smith", "[email protected]"], ["Bob Gold", "[email protected]"], ["Frank White", "[email protected]"]] Gotchas: The ExpandDL call to EWS requires the exact email address or name of the distribution list to get results. That's how MS did it. I plan on fixing it in another little version to do the following (in case you want to do it yourself): if no results are found for the expandDL call: perform a resolveNames call for the lookup passed and get any PublicDL results that match redo the expandDL call with the proper name/email address else "No results found" for real this time Future I'll probably write a few more classes to ineract with things like calendars and public folders allthough I honestly don't use them much.
About
Simple example of accessing Microsoft Exchange Web Services via Ruby
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published