rews
Rews is a simple Ruby client for Exchange Web Services.
-
Searching, fetching and deletion are supported.
-
Filtering, ordering, and arbitrary property retrieval are supported.
-
Bulk operations are supported
Method names generally follow the Exchange Web Services API msdn.microsoft.com/en-us/library/bb409286(EXCHG.140).aspx
to use :
# create a client
c = Rews::Client.new("https://exchange.bar.com/EWS/Exchange.asmx", :ntlm, 'EXCHDOM\foo', 'password')
# find a distinguished folder from any one of the mailboxes the user has permissions for
inbox=c.distinguished_folder_id('inbox', '[email protected]')
# find some message_ids,
mids = inbox.find_item_id(:restriction=>[:<=, "item:DateTimeReceived",DateTime.now],
:sort_order=>[["item:DateTimeReceived", "Ascending"]],
:indexed_page_item_view=>{:max_entries_returned=>10, :offset=>0})
# get some properties for a bunch of messages in one hit
= inbox.get_item(mids, :item_shape=>{
:base_shape=>:IdOnly,
:additional_properties=>[
[:field_uri, "item:Subject"],
[:field_uri, "item:DateTimeReceived"],
[:field_uri, "message:InternetMessageId"]]})
# delete the items to the DeletedItems folder
inbox.delete_item(mids, :delete_type=>:MoveToDeletedItems)
Install
gem install rews
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2011 Trampoline Systems Ltd. See LICENSE for details.