Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can admin account fetch a calendar entries with all properties of the meetings? #264

Open
divyaiyer opened this issue Aug 4, 2017 · 0 comments

Comments

@divyaiyer
Copy link

divyaiyer commented Aug 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant