-
Notifications
You must be signed in to change notification settings - Fork 173
Description
We are developing an app and we need to interact with ews api, using viewpoint for the same. May I know how can I fetch a meeting room's calendar entries with all details like who is the organizer, required attendees, start and end time etc. Tried following code using acts_as and impersonate (admin account I am trying has impersonate role), but it returns empty array. Your help will be highly appreciated. Thank you.
@gshutler
require 'rubygems'
require 'viewpoint'
require 'time'
require 'json'
require 'active_support'
require 'active_support/time'
require 'viewpoint/logging/config'
include Viewpoint::EWS
endpoint = 'https://outlook.office365.com/EWS/Exchange.asmx'
user = '[email protected]'
pass = 'xxxxx'
cli = Viewpoint::EWSClient.new endpoint, user, pass
start_time = Time.now.iso8601 #DateTime.parse("2017-08-03").iso8601
end_time = (Time.now + 7.days).iso8601 #DateTime.parse("2017-08-04").iso8601
calendar = cli.get_folder(:calendar,opts={acts_as:'[email protected]'})
puts "---++++++++++-----"
cals = calendar.items_between start_time,end_time
h_array = []
hash = {}
puts cals.count
cals.each do |c|
hash[:subject] = c.subject
hash[:start_time] = c.start
hash[:end_time] = c.end
hash[:organizer] = c.organizer.name
a = []
c.required_attendees.each do |att|
a << att.email
end
hash[:attendees] = a
h_array << hash
end
puts h_array