Class: Viewpoint::EWS::SOAP::ExchangeWebService
- Inherits:
-
Object
- Object
- Viewpoint::EWS::SOAP::ExchangeWebService
- Includes:
- Viewpoint::EWS, Viewpoint::EWS::SOAP, ExchangeAvailability, ExchangeDataServices, ExchangeNotification, ExchangeSynchronization, ExchangeTimeZones, ExchangeUserConfiguration, StringUtils
- Defined in:
- lib/ews/soap/exchange_web_service.rb
Constant Summary
Constants included from Viewpoint::EWS::SOAP
ActiveDirectory, ActiveDirectoryContacts, Contacts, ContactsActiveDirectory, HARD_DELETE, MOVE_TO_DELETED_ITEMS, NAMESPACES, NS_EWS_MESSAGES, NS_EWS_TYPES, NS_SOAP, SOFT_DELETE, VERSION_2007, VERSION_2007_SP1, VERSION_2010, VERSION_2010_SP1, VERSION_2010_SP2, VERSION_2013, VERSION_2013_SP1, VERSION_NONE
Constants included from StringUtils
Constants included from Viewpoint::EWS
Instance Attribute Summary collapse
-
#auto_deepen ⇒ Object
Returns the value of attribute auto_deepen.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#impersonation_address ⇒ Object
Returns the value of attribute impersonation_address.
-
#impersonation_type ⇒ Object
Returns the value of attribute impersonation_type.
-
#no_auto_deepen_behavior ⇒ Object
Returns the value of attribute no_auto_deepen_behavior.
-
#server_version ⇒ Object
Returns the value of attribute server_version.
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
-
#add_delegate(owner, delegate, permissions) ⇒ Object
Adds one or more delegates to a principal’s mailbox and sets specific access permissions.
- #create_managed_folder ⇒ Object
- #delete_attachment ⇒ Object
-
#do_soap_request(soapmsg, opts = {}) ⇒ Object
Send the SOAP request to the endpoint and parse it.
-
#get_delegate(owner) ⇒ Object
Retrieves the delegate settings for a specific mailbox.
-
#get_room_lists ⇒ Object
Gets the room lists that are available within the Exchange organization.
-
#get_rooms(roomDistributionList) ⇒ Object
Gets the rooms that are in the specified room distribution list.
-
#get_user_availability(opts) ⇒ Object
Provides detailed information about the availability of a set of users, rooms, and resources within a specified time window.
-
#initialize(connection, opts = {}) ⇒ ExchangeWebService
constructor
A new instance of ExchangeWebService.
- #parse_soap_response(soapmsg, opts = {}) ⇒ Object
-
#remove_delegate(owner, delegate) ⇒ Object
Removes one or more delegates from a user’s mailbox.
-
#update_delegate(owner, delegate, permissions) ⇒ Object
Updates delegate permissions on a principal’s mailbox.
Methods included from ExchangeTimeZones
#get_time_zones, #set_time_zone_context
Methods included from ExchangeSynchronization
#sync_folder_hierarchy, #sync_folder_items
Methods included from ExchangeUserConfiguration
Methods included from ExchangeAvailability
#get_user_oof_settings, #set_user_oof_settings
Methods included from ExchangeNotification
#get_events, #pull_subscribe_folder, #push_subscribe_folder, #subscribe, #unsubscribe
Methods included from ExchangeDataServices
#convert_id, #copy_folder, #copy_item, #create_attachment, #create_folder, #create_item, #delete_folder, #delete_item, #empty_folder, #expand_dl, #export_items, #find_folder, #find_item, #get_attachment, #get_folder, #get_item, #move_folder, #move_item, #resolve_names, #send_item, #update_folder, #update_item
Methods included from StringUtils
Methods included from Viewpoint::EWS
#remove_impersonation, root_logger, #set_impersonation
Constructor Details
#initialize(connection, opts = {}) ⇒ ExchangeWebService
Returns a new instance of ExchangeWebService.
39 40 41 42 43 44 45 46 47 |
# File 'lib/ews/soap/exchange_web_service.rb', line 39 def initialize(connection, opts = {}) super() @connection = connection @server_version = opts[:server_version] ? opts[:server_version] : VERSION_2010 @auto_deepen = true @no_auto_deepen_behavior = :raise @impersonation_type = "" @impersonation_address = "" end |
Instance Attribute Details
#auto_deepen ⇒ Object
Returns the value of attribute auto_deepen.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def auto_deepen @auto_deepen end |
#connection ⇒ Object
Returns the value of attribute connection.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def connection @connection end |
#impersonation_address ⇒ Object
Returns the value of attribute impersonation_address.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def impersonation_address @impersonation_address end |
#impersonation_type ⇒ Object
Returns the value of attribute impersonation_type.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def impersonation_type @impersonation_type end |
#no_auto_deepen_behavior ⇒ Object
Returns the value of attribute no_auto_deepen_behavior.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def no_auto_deepen_behavior @no_auto_deepen_behavior end |
#server_version ⇒ Object
Returns the value of attribute server_version.
31 32 33 |
# File 'lib/ews/soap/exchange_web_service.rb', line 31 def server_version @server_version end |
Instance Method Details
#add_delegate(owner, delegate, permissions) ⇒ Object
Adds one or more delegates to a principal’s mailbox and sets specific access permissions.
87 88 89 90 91 92 93 94 95 |
# File 'lib/ews/soap/exchange_web_service.rb', line 87 def add_delegate(owner, delegate, ) action = "#{SOAP_ACTION_PREFIX}/AddDelegate" resp = invoke("#{NS_EWS_MESSAGES}:AddDelegate", action) do |root| build!(root) do add_delegate!(owner, delegate, ) end end parse_soap_response(resp) end |
#create_managed_folder ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/ews/soap/exchange_web_service.rb', line 57 def create_managed_folder action = "#{SOAP_ACTION_PREFIX}/CreateManagedFolder" resp = invoke("#{NS_EWS_MESSAGES}:CreateManagedFolder", action) do |create_managed_folder| build_create_managed_folder!(create_managed_folder) end parse_create_managed_folder(resp) end |
#delete_attachment ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/ews/soap/exchange_web_service.rb', line 49 def action = "#{SOAP_ACTION_PREFIX}/DeleteAttachment" resp = invoke("#{NS_EWS_MESSAGES}:DeleteAttachment", action) do || () end (resp) end |
#do_soap_request(soapmsg, opts = {}) ⇒ Object
make this work for Viewpoint (imported from SPWS)
Send the SOAP request to the endpoint and parse it.
205 206 207 208 209 210 211 212 213 |
# File 'lib/ews/soap/exchange_web_service.rb', line 205 def do_soap_request(soapmsg, opts = {}) @log.debug <<-EOF.gsub(/^ {8}/, '') Sending SOAP Request: ---------------- #{soapmsg} ---------------- EOF connection.dispatch(self, soapmsg, opts) end |
#get_delegate(owner) ⇒ Object
Retrieves the delegate settings for a specific mailbox.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ews/soap/exchange_web_service.rb', line 69 def get_delegate(owner) action = "#{SOAP_ACTION_PREFIX}/GetDelegate" resp = invoke("#{NS_EWS_MESSAGES}:GetDelegate", action) do |root| root.set_attr('IncludePermissions', 'true') build!(root) do mailbox!(root, {:email_address => {:text => owner}}) end end parse_soap_response(resp) end |
#get_room_lists ⇒ Object
Gets the room lists that are available within the Exchange organization.
189 190 191 192 193 194 195 196 197 |
# File 'lib/ews/soap/exchange_web_service.rb', line 189 def get_room_lists req = build_soap! do |type, builder| if(type == :header) else builder.room_lists! end end do_soap_request(req, response_class: EwsSoapRoomlistResponse) end |
#get_rooms(roomDistributionList) ⇒ Object
Gets the rooms that are in the specified room distribution list
174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/ews/soap/exchange_web_service.rb', line 174 def get_rooms(roomDistributionList) req = build_soap! do |type, builder| if(type == :header) else builder.nbuild.GetRooms {|x| x.parent.default_namespace = @default_ns builder.room_list!(roomDistributionList) } end end do_soap_request(req, response_class: EwsSoapRoomResponse) end |
#get_user_availability(opts) ⇒ Object
Finish out :suggestions_view_options
Provides detailed information about the availability of a set of users, rooms, and resources within a specified time window.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/ews/soap/exchange_web_service.rb', line 149 def get_user_availability(opts) opts = opts.clone req = build_soap! do |type, builder| if(type == :header) else builder.nbuild.GetUserAvailabilityRequest {|x| x.parent.default_namespace = @default_ns builder.time_zone!(opts[:time_zone]) builder.nbuild.MailboxDataArray { opts[:mailbox_data].each do |mbd| builder.mailbox_data!(mbd) end } builder.(opts[:free_busy_view_options]) builder.(opts[:suggestions_view_options]) } end end do_soap_request(req, response_class: EwsSoapFreeBusyResponse) end |
#parse_soap_response(soapmsg, opts = {}) ⇒ Object
218 219 220 221 222 |
# File 'lib/ews/soap/exchange_web_service.rb', line 218 def parse_soap_response(soapmsg, opts = {}) raise EwsError, "Can't parse an empty response. Please check your endpoint." if(soapmsg.nil?) opts[:response_class] ||= EwsSoapResponse EwsParser.new(soapmsg).parse(opts) end |
#remove_delegate(owner, delegate) ⇒ Object
Removes one or more delegates from a user’s mailbox.
102 103 104 105 106 107 108 109 110 |
# File 'lib/ews/soap/exchange_web_service.rb', line 102 def remove_delegate(owner, delegate) action = "#{SOAP_ACTION_PREFIX}/RemoveDelegate" resp = invoke("#{NS_EWS_MESSAGES}:RemoveDelegate", action) do |root| build!(root) do remove_delegate!(owner, delegate) end end parse_soap_response(resp) end |
#update_delegate(owner, delegate, permissions) ⇒ Object
Updates delegate permissions on a principal’s mailbox
119 120 121 122 123 124 125 126 127 |
# File 'lib/ews/soap/exchange_web_service.rb', line 119 def update_delegate(owner, delegate, ) action = "#{SOAP_ACTION_PREFIX}/UpdateDelegate" resp = invoke("#{NS_EWS_MESSAGES}:UpdateDelegate", action) do |root| build!(root) do add_delegate!(owner, delegate, ) end end parse_soap_response(resp) end |