-
Notifications
You must be signed in to change notification settings - Fork 171
Home
ephekt edited this page Apr 12, 2012
·
7 revisions
Viewpoint is a client library for Microsoft Exchange Web Services. Stay tuned to this wiki for example usage and other documentation.
If you are using Viewpoint for a project drop me a line on Github and let me know what you’re using it for and how it’s working for you. I’d love to list your name or company here.
Ruby 1.9 users: make sure and require 'kconv'
. This is a requirement of rubyntlm.
Get a Folder object that represents your Inbox.
Viewpoint::EWS::EWS.endpoint = 'http://myemail.com/ews/exchange.asmx'
Viewpoint::EWS::EWS.set_auth 'username','password'
inbox = Viewpoint::EWS::Folder.get_folder_by_name('Inbox')
Get attachments from an Item object. The Item#attachments method will return an array of a subclass of Attachment.
items = inbox.find_items
attmts = items[3].attachments
# This will save the file to the current directory with the default filename
# You can specify a path + name if you want to change this behavior. #save_to_file(dir_path, file_name)
attmts.first.save_to_file
# If you'd like to look at the data without saving to file you can unpack it (Base64 decode)
# attmts.first.unpack('m').first # returns an array with unpacked data, pull the first one