Skip to content

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

Description

@divyaiyer

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 = 'xxxx@onmicrosoft.com'
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:'confxx@onmicrosoft.com'})
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions