No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Ruby library for accessing Microsoft Exchange using Exchange Web Services
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 0.9.2
~> 3.5.0
~> 3.0.1
~> 2.1.0
>= 0

Runtime

>= 2.1.5.2
>= 1.3.0
>= 0.1.1
>= 0.3.33
 Project Readme

Exchanger

Continuous Integration status

Ruby library for accessing Microsoft Exchange using Exchange Web Services. This library tries to make creating and updating items as easy as possible. It will keep track of changed properties and will update only them.

Supported operations

  • FindItem, GetItem, CreateItem, UpdateItem, DeleteItem, MoveItem
  • FindFolder, GetFolder
  • ResolveNames, ExpandDL
  • GetUserAvailability
  • GetAttachment, CreateAttachment, DeleteAttachment

Installing

gem install exchanger

Configuration

Exchanger.configure do |config|
  config.endpoint = "https://domain.com/EWS/Exchanger.asmx"
  config.username = "username"
  config.password = "password"
  config.debug = true # show Exchange request/response info
end

or configure from YAML

Exchanger::Config.instance.from_hash(YAML.load_file("#{Rails.root}/config/exchanger.yml")[Rails.env])

Examples

Creating and updating contacts

folder = Exchanger::Folder.find(:contacts)
contact = folder.new_contact
contact.given_name = "Edgars"
contact.surname = "Beigarts"
contact.email_addresses = [ Exchanger::EmailAddress.new(:key => "EmailAddress1", :text => "me@example.com") ]
contact.phone_numbers = [ Exchanger::PhoneNumber.new(:key => "MobilePhone", :text => "+371 80000000") ]
contact.save # CreateItem operation
contact.company_name = "Example Inc."
contact.save # UpdateItem operation
contact.destroy # DeleteItem operation

Searching in Global Address Book

mailboxes = Exchanger::Mailbox.search("John")

Searching for Calendar items

More specific Exchange calendar documentation can be found here.

  1. Return all Calendar items with recurring master appointments (without recurring). Also called as non-expanded view.
folder = Exchanger::Folder.find(:calendar, "email@example.com")
folder.items # return Exchanger::CalendarItem items
  1. Return Calendar items providing CalendarView (with recurring).

Supported CalendarView options/attributes:

  • max_entries_returned
  • start_date
  • end_date
folder = Exchanger::Folder.find(:calendar, "email@example.com")
calendar_view_options = {
  start_date: (DateTime.now - 1.week),
  end_date:   DateTime.now,
}
folder.expanded_items(calendar_view_options) # return Exchanger::CalendarItem items

Running specs with Exchange Server

The easiest way is to sign up for a Microsoft Office 365 free trial. Please not that this needs to be the "Professional" version in order to be able to access the distribution lists. You also need to finish the setup, including e-mail, to be able to execute the steps below. Provisioning mail boxes can take up to 24 hours.

  1. Create a random calendar entry in July 2016
  2. Create a distribution list named 'Test'
    • This is available under the app "People" > "New group"
  3. Create spec/config.yml with your Exchange credentials
  4. Create spec/fixtures/get_user_availability.yml with your Exchange email address
  5. Clear the recorded VCR cassettes by removing spec/cassettes
  6. Run the specs rake spec

It looks like Office 365 trial has some rate limits, so you may have to record the VCR cassettes for each spec separately.

Exchanger::Operation::ResponseError:
  An internal server error occurred. Try again later.

Alternatives