Class: Viewpoint::EWS::SOAP::ExchangeWebService
- Inherits:
-
Handsoap::Service
- Object
- Handsoap::Service
- Viewpoint::EWS::SOAP::ExchangeWebService
- Includes:
- Viewpoint::EWS::SOAP
- Defined in:
- lib/soap/handsoap/ews_service.rb
Constant Summary collapse
- SOAP_ACTION_PREFIX =
"http://schemas.microsoft.com/exchange/services/2006/messages"
- @@raw_soap =
false
- @@http_options =
nil
Constants included from Viewpoint::EWS::SOAP
ActiveDirectory, ActiveDirectoryContacts, Contacts, ContactsActiveDirectory, NS_EWS_MESSAGES, NS_EWS_TYPES, NS_SOAP
Class Method Summary collapse
-
.raw_soap! ⇒ Object
Turn off parsing and just return the soap response.
- .set_auth(user, pass) ⇒ Object
-
.set_http_options(option_hash) ⇒ Object
Set various HTTP options like ssl_ca_trust, etc.
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.
- #convert_id ⇒ Object
- #copy_folder ⇒ Object
-
#copy_item(item_ids, folder_id) ⇒ Object
Copies items and puts the items in a different folder.
-
#create_attachment(parent_id, files = [], items = []) ⇒ Object
Creates either an item or file attachment and attaches it to the specified item.
-
#create_calendar_item(folder_id, items, send_invites = 'SendToAllAndSaveCopy') ⇒ Object
Operation is used to create calendar items.
-
#create_contact_item(folder_id, items) ⇒ Object
Operation is used to create contact items This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
-
#create_folder(parent_folder_id, folder_name) ⇒ Object
Creates folders, calendar folders, contacts folders, tasks folders, and search folders.
- #create_managed_folder ⇒ Object
-
#create_message_item(folder_id, items, message_disposition = 'SaveOnly') ⇒ Object
Operation is used to create e-mail messages This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
-
#create_task_item(folder_id, items, message_disposition = 'SaveOnly') ⇒ Object
Operation is used to create task items This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
- #delete_attachment ⇒ Object
-
#delete_folder(folder_id, delete_type = 'MoveToDeletedItems') ⇒ Object
Deletes folders from a mailbox.
-
#delete_item(item_ids, delete_type, send_meeting_cancellations = nil, affected_task_occurrences = nil) ⇒ Object
Delete an item from a mailbox in the Exchange store.
-
#expand_dl(dist_email) ⇒ Object
Exposes the full membership of distribution lists.
-
#find_folder(parent_folder_ids = [:root], traversal = 'Shallow', folder_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Find subfolders of an identified folder.
-
#find_item(parent_folder_ids, traversal = 'Shallow', item_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Identifies items that are located in a specified folder.
-
#get_attachment(attachment_ids) ⇒ Object
Used to retrieve existing attachments on items in the Exchange store.
-
#get_delegate(owner) ⇒ Object
Retrieves the delegate settings for a specific mailbox.
-
#get_events(subscription_id, watermark) ⇒ Object
Used by pull subscription clients to request notifications from the Client Access server.
-
#get_folder(folder_ids, folder_shape = {:base_shape => 'Default'}, act_as = nil) ⇒ Object
Gets folders from the Exchange store.
-
#get_item(item_ids, item_shape = {}) ⇒ Object
Gets items from the Exchange store.
-
#get_user_availability ⇒ Object
Provides detailed information about the availability of a set of users, rooms, and resources within a specified time window.
-
#get_user_oof_settings(mailbox) ⇒ Object
Gets a mailbox user’s Out of Office (OOF) settings and messages.
-
#initialize ⇒ ExchangeWebService
constructor
A new instance of ExchangeWebService.
- #move_folder ⇒ Object
-
#move_item(item_ids, folder_id) ⇒ Object
Used to move one or more items to a single destination folder.
- #on_after_create_http_request(req) ⇒ Object
- #on_create_document(doc) ⇒ Object
- #on_http_error(response) ⇒ Object
-
#on_response_document(doc) ⇒ Object
Adds knowledge of namespaces to the response object.
-
#push_subscribe(folder_ids, event_types, url, watermark = nil, status_frequency = 5) ⇒ Object
Used to subscribe client applications to either push or pull notifications.
-
#remove_delegate(owner, delegate) ⇒ Object
Removes one or more delegates from a user’s mailbox.
-
#resolve_names(name, full_contact_data = true, opts = {}) ⇒ Object
Resolve ambiguous e-mail addresses and display names.
-
#send_item(item_ids, save_item = true, saved_item_folder = nil) ⇒ Object
Used to send e-mail messages that are located in the Exchange store.
-
#set_user_oof_settings(mailbox, oof_state, ext_audience, dt_start, dt_end, int_msg, ext_mg) ⇒ Object
Sets a mailbox user’s Out of Office (OOF) settings and message.
-
#subscribe(folder_ids, event_types, timeout = 10) ⇒ Object
Used to subscribe client applications to either push or pull notifications.
-
#sync_folder_hierarchy ⇒ Object
Defines a request to synchronize a folder hierarchy on a client.
-
#sync_folder_items(folder_id, sync_state = nil, max_changes = 256, item_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Synchronizes items between the Exchange server and the client.
-
#unsubscribe(subscription_id) ⇒ Object
End a pull notification subscription.
-
#update_delegate(owner, delegate, permissions) ⇒ Object
Updates delegate permissions on a principal’s mailbox.
- #update_folder ⇒ Object
-
#update_item(item_ids, changes, opts = {:message_disposition => 'SaveOnly', :conflict_resolution => 'AutoResolve'}) ⇒ Object
Used to modify the properties of an existing item in the Exchange store.
Constructor Details
#initialize ⇒ ExchangeWebService
Returns a new instance of ExchangeWebService.
36 37 38 39 40 41 |
# File 'lib/soap/handsoap/ews_service.rb', line 36 def initialize() if $DEBUG @debug = File.new('ews_debug.out', 'w') @debug.sync = true end end |
Class Method Details
.raw_soap! ⇒ Object
Turn off parsing and just return the soap response
49 50 51 |
# File 'lib/soap/handsoap/ews_service.rb', line 49 def self.raw_soap! @@raw_soap = true end |
.set_auth(user, pass) ⇒ Object
43 44 45 46 |
# File 'lib/soap/handsoap/ews_service.rb', line 43 def self.set_auth(user,pass) @@user = user @@pass = pass end |
.set_http_options(option_hash) ⇒ Object
Set various HTTP options like ssl_ca_trust, etc
54 55 56 57 58 59 60 |
# File 'lib/soap/handsoap/ews_service.rb', line 54 def self.(option_hash) if @@http_options.nil? @@http_options = option_hash else @@http_options.merge!(option_hash) end 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.
686 687 688 689 690 691 692 693 694 |
# File 'lib/soap/handsoap/ews_service.rb', line 686 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!(resp) end |
#convert_id ⇒ Object
230 231 232 233 234 235 236 |
# File 'lib/soap/handsoap/ews_service.rb', line 230 def convert_id action = "#{SOAP_ACTION_PREFIX}/ConvertId" resp = invoke("#{NS_EWS_MESSAGES}:ConvertId", action) do |convert_id| build_convert_id!(convert_id) end parse_convert_id(resp) end |
#copy_folder ⇒ Object
296 297 298 299 300 301 302 |
# File 'lib/soap/handsoap/ews_service.rb', line 296 def copy_folder action = "#{SOAP_ACTION_PREFIX}/CopyFolder" resp = invoke("#{NS_EWS_MESSAGES}:CopyFolder", action) do |copy_folder| build_copy_folder!(copy_folder) end parse_copy_folder(resp) end |
#copy_item(item_ids, folder_id) ⇒ Object
Copies items and puts the items in a different folder
602 603 604 605 606 607 608 609 610 611 |
# File 'lib/soap/handsoap/ews_service.rb', line 602 def copy_item(item_ids, folder_id) action = "#{SOAP_ACTION_PREFIX}/CopyItem" resp = invoke("#{NS_EWS_MESSAGES}:CopyItem", action) do |root| build!(root) do to_folder_id!(root, folder_id) item_ids!(root, item_ids) end end parse!(resp) end |
#create_attachment(parent_id, files = [], items = []) ⇒ Object
Need to implement attachment of Item types
Creates either an item or file attachment and attaches it to the specified item.
623 624 625 626 627 628 629 630 631 632 |
# File 'lib/soap/handsoap/ews_service.rb', line 623 def (parent_id, files = [], items = []) action = "#{SOAP_ACTION_PREFIX}/CreateAttachment" resp = invoke("#{NS_EWS_MESSAGES}:CreateAttachment", action) do |root| build!(root) do item_id!(root, parent_id, "#{NS_EWS_MESSAGES}:ParentItemId") (root, files, items) end end parse!(resp) end |
#create_calendar_item(folder_id, items, send_invites = 'SendToAllAndSaveCopy') ⇒ Object
Operation is used to create calendar items
470 471 472 473 474 475 476 477 478 |
# File 'lib/soap/handsoap/ews_service.rb', line 470 def create_calendar_item(folder_id, items, send_invites = 'SendToAllAndSaveCopy') action = "#{SOAP_ACTION_PREFIX}/CreateItem" resp = invoke("#{NS_EWS_MESSAGES}:CreateItem", action) do |node| build!(node) do create_item!(folder_id, items, =false, send_invites, 'calendar') end end parse!(resp) end |
#create_contact_item(folder_id, items) ⇒ Object
Operation is used to create contact items This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
512 513 514 515 516 517 518 519 520 |
# File 'lib/soap/handsoap/ews_service.rb', line 512 def create_contact_item(folder_id, items) action = "#{SOAP_ACTION_PREFIX}/CreateItem" resp = invoke("#{NS_EWS_MESSAGES}:CreateItem", action) do |node| build!(node) do create_item!(folder_id, items, nil, false, 'contact') end end parse!(resp) end |
#create_folder(parent_folder_id, folder_name) ⇒ Object
Creates folders, calendar folders, contacts folders, tasks folders, and search folders.
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/soap/handsoap/ews_service.rb', line 244 def create_folder(parent_folder_id, folder_name) action = "#{SOAP_ACTION_PREFIX}/CreateFolder" resp = invoke("#{NS_EWS_MESSAGES}:CreateFolder", action) do |root| build!(root) do root.add("#{NS_EWS_MESSAGES}:ParentFolderId") do |pfid| folder_id!(pfid, parent_folder_id) end folder_name = (folder_name.is_a?(Array)) ? folder_name : [folder_name] root.add("#{NS_EWS_MESSAGES}:Folders") do |fids| folder_name.each do |f| add_hierarchy!(fids, {:folder => {:display_name => {:text => f}}}) end end end end parse!(resp) end |
#create_managed_folder ⇒ Object
656 657 658 659 660 661 662 |
# File 'lib/soap/handsoap/ews_service.rb', line 656 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 |
#create_message_item(folder_id, items, message_disposition = 'SaveOnly') ⇒ Object
Operation is used to create e-mail messages This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
451 452 453 454 455 456 457 458 459 |
# File 'lib/soap/handsoap/ews_service.rb', line 451 def (folder_id, items, = 'SaveOnly') action = "#{SOAP_ACTION_PREFIX}/CreateItem" resp = invoke("#{NS_EWS_MESSAGES}:CreateItem", action) do |node| build!(node) do create_item!(folder_id, items, , send_invites=false, 'message') end end parse!(resp) end |
#create_task_item(folder_id, items, message_disposition = 'SaveOnly') ⇒ Object
Operation is used to create task items This is actually a CreateItem operation but they differ for different types of Exchange objects so it is named appropriately here.
492 493 494 495 496 497 498 499 500 |
# File 'lib/soap/handsoap/ews_service.rb', line 492 def create_task_item(folder_id, items, = 'SaveOnly') action = "#{SOAP_ACTION_PREFIX}/CreateItem" resp = invoke("#{NS_EWS_MESSAGES}:CreateItem", action) do |node| build!(node) do create_item!(folder_id, items, , false, 'task') end end parse!(resp) end |
#delete_attachment ⇒ Object
634 635 636 637 638 639 640 |
# File 'lib/soap/handsoap/ews_service.rb', line 634 def action = "#{SOAP_ACTION_PREFIX}/DeleteAttachment" resp = invoke("#{NS_EWS_MESSAGES}:DeleteAttachment", action) do || () end (resp) end |
#delete_folder(folder_id, delete_type = 'MoveToDeletedItems') ⇒ Object
Deletes folders from a mailbox.
268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/soap/handsoap/ews_service.rb', line 268 def delete_folder(folder_id, delete_type = 'MoveToDeletedItems') action = "#{SOAP_ACTION_PREFIX}/DeleteFolder" resp = invoke("#{NS_EWS_MESSAGES}:DeleteFolder", action) do |root| build!(root) do root.set_attr('DeleteType', delete_type) folder_id = (folder_id.is_a?(Array)) ? folder_id : [folder_id] folder_ids!(root, folder_id) end end parse!(resp) end |
#delete_item(item_ids, delete_type, send_meeting_cancellations = nil, affected_task_occurrences = nil) ⇒ Object
Delete an item from a mailbox in the Exchange store
530 531 532 533 534 535 536 537 538 539 540 541 |
# File 'lib/soap/handsoap/ews_service.rb', line 530 def delete_item(item_ids, delete_type, send_meeting_cancellations = nil, affected_task_occurrences = nil) action = "#{SOAP_ACTION_PREFIX}/DeleteItem" resp = invoke("#{NS_EWS_MESSAGES}:DeleteItem", action) do |root| build!(root) do root.set_attr('DeleteType', delete_type) root.set_attr('SendMeetingCancellations', send_meeting_cancellations) unless send_meeting_cancellations.nil? root.set_attr('AffectedTaskOccurrences', affected_task_occurrences) unless affected_task_occurrences.nil? item_ids!(root, item_ids) end end parse!(resp) end |
#expand_dl(dist_email) ⇒ Object
Fully support all of the ExpandDL operations. Today it just supports taking an e-mail address as an argument
Exposes the full membership of distribution lists.
129 130 131 132 133 134 135 136 137 |
# File 'lib/soap/handsoap/ews_service.rb', line 129 def (dist_email) action = "#{SOAP_ACTION_PREFIX}/ExpandDL" resp = invoke("#{NS_EWS_MESSAGES}:ExpandDL", action) do |root| build!(root) do mailbox!(root, {:email_address => {:text => dist_email}}) end end parse!(resp) end |
#find_folder(parent_folder_ids = [:root], traversal = 'Shallow', folder_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Find subfolders of an identified folder
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/soap/handsoap/ews_service.rb', line 151 def find_folder(parent_folder_ids = [:root], traversal = 'Shallow', folder_shape = {:base_shape => 'Default'}, opts = {}) action = "#{SOAP_ACTION_PREFIX}/FindFolder" resp = invoke("#{NS_EWS_MESSAGES}:FindFolder", action) do |root| build!(root) do restriction = opts.delete(:restriction) root.set_attr('Traversal', traversal) folder_shape!(root, folder_shape) root.add("#{NS_EWS_MESSAGES}:Restriction") do |r| add_hierarchy!(r, restriction) end unless restriction.nil? parent_folder_ids!(root, parent_folder_ids) end end parse!(resp) end |
#find_item(parent_folder_ids, traversal = 'Shallow', item_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Identifies items that are located in a specified folder
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/soap/handsoap/ews_service.rb', line 181 def find_item(parent_folder_ids, traversal = 'Shallow', item_shape = {:base_shape => 'Default'}, opts = {}) action = "#{SOAP_ACTION_PREFIX}/FindItem" resp = invoke("#{NS_EWS_MESSAGES}:FindItem", action) do |root| build!(root) do root.set_attr('Traversal', traversal) item_shape!(root, item_shape) query_strings = opts.delete(:query_string) restriction = opts.delete(:restriction) if(opts.has_key?(:calendar_view)) cal_view = opts[:calendar_view] cal_view.each_pair do |k,v| cal_view[k] = v.to_s end end add_hierarchy!(root, opts, NS_EWS_MESSAGES) #query_strings!(query_strings) root.add("#{NS_EWS_MESSAGES}:Restriction") do |r| add_hierarchy!(r, restriction) end unless restriction.nil? parent_folder_ids!(root, parent_folder_ids) end end parse!(resp) end |
#get_attachment(attachment_ids) ⇒ Object
Used to retrieve existing attachments on items in the Exchange store
645 646 647 648 649 650 651 652 653 654 |
# File 'lib/soap/handsoap/ews_service.rb', line 645 def () action = "#{SOAP_ACTION_PREFIX}/GetAttachment" resp = invoke("#{NS_EWS_MESSAGES}:GetAttachment", action) do |root| build!(root) do (root) (root, ) end end parse!(resp) end |
#get_delegate(owner) ⇒ Object
Retrieves the delegate settings for a specific mailbox.
668 669 670 671 672 673 674 675 676 677 |
# File 'lib/soap/handsoap/ews_service.rb', line 668 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!(resp) end |
#get_events(subscription_id, watermark) ⇒ Object
Used by pull subscription clients to request notifications from the Client Access server
358 359 360 361 362 363 364 365 366 367 |
# File 'lib/soap/handsoap/ews_service.rb', line 358 def get_events(subscription_id, watermark) action = "#{SOAP_ACTION_PREFIX}/GetEvents" resp = invoke("#{NS_EWS_MESSAGES}:GetEvents", action) do |root| build!(root) do subscription_id!(root, subscription_id) watermark!(root, watermark) end end parse!(resp) end |
#get_folder(folder_ids, folder_shape = {:base_shape => 'Default'}, act_as = nil) ⇒ Object
Gets folders from the Exchange store
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/soap/handsoap/ews_service.rb', line 219 def get_folder(folder_ids, folder_shape = {:base_shape => 'Default'}, act_as = nil) action = "#{SOAP_ACTION_PREFIX}/GetFolder" resp = invoke("#{NS_EWS_MESSAGES}:GetFolder", action) do |root| build!(root) do folder_shape!(root, folder_shape) folder_ids!(root, folder_ids, act_as) end end parse!(resp) end |
#get_item(item_ids, item_shape = {}) ⇒ Object
Gets items from the Exchange store
427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/soap/handsoap/ews_service.rb', line 427 def get_item(item_ids, item_shape = {}) action = "#{SOAP_ACTION_PREFIX}/GetItem" item_shape[:base_shape] = 'Default' unless item_shape.has_key?(:base_shape) resp = invoke("#{NS_EWS_MESSAGES}:GetItem", action) do |root| build!(root) do item_shape!(root, item_shape) item_ids!(root, item_ids) end end parse!(resp) end |
#get_user_availability ⇒ Object
Provides detailed information about the availability of a set of users, rooms, and resources within a specified time window.
731 732 733 734 735 736 737 |
# File 'lib/soap/handsoap/ews_service.rb', line 731 def get_user_availability action = "#{SOAP_ACTION_PREFIX}/GetUserAvailability" resp = invoke("#{NS_EWS_MESSAGES}:GetUserAvailability", action) do |get_user_availability| build_get_user_availability!(get_user_availability) end parse_get_user_availability(resp) end |
#get_user_oof_settings(mailbox) ⇒ Object
Gets a mailbox user’s Out of Office (OOF) settings and messages.
741 742 743 744 745 746 747 748 749 |
# File 'lib/soap/handsoap/ews_service.rb', line 741 def get_user_oof_settings(mailbox) action = "#{SOAP_ACTION_PREFIX}/GetUserOofSettings" resp = invoke("#{NS_EWS_MESSAGES}:GetUserOofSettingsRequest", action) do |root| build!(root) do mailbox!(root,mailbox[:mailbox],NS_EWS_TYPES) end end parse!(resp) end |
#move_folder ⇒ Object
288 289 290 291 292 293 294 |
# File 'lib/soap/handsoap/ews_service.rb', line 288 def move_folder action = "#{SOAP_ACTION_PREFIX}/MoveFolder" resp = invoke("#{NS_EWS_MESSAGES}:MoveFolder", action) do |move_folder| build_move_folder!(move_folder) end parse_move_folder(resp) end |
#move_item(item_ids, folder_id) ⇒ Object
Used to move one or more items to a single destination folder.
586 587 588 589 590 591 592 593 594 595 |
# File 'lib/soap/handsoap/ews_service.rb', line 586 def move_item(item_ids, folder_id) action = "#{SOAP_ACTION_PREFIX}/MoveItem" resp = invoke("#{NS_EWS_MESSAGES}:MoveItem", action) do |root| build!(root) do to_folder_id!(root, folder_id) item_ids!(root, item_ids) end end parse!(resp) end |
#on_after_create_http_request(req) ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/soap/handsoap/ews_service.rb', line 84 def on_after_create_http_request(req) begin req.set_auth @@user, @@pass rescue NameError => e raise EwsLoginError, "Please remember to set your credential information." end end |
#on_create_document(doc) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/soap/handsoap/ews_service.rb', line 65 def on_create_document(doc) doc.alias NS_EWS_TYPES, 'http://schemas.microsoft.com/exchange/services/2006/types' doc.alias NS_EWS_MESSAGES, 'http://schemas.microsoft.com/exchange/services/2006/messages' header = doc.find('Header') header.add("#{NS_EWS_TYPES}:RequestServerVersion") { |rsv| rsv.set_attr('Version','Exchange2007_SP1') } end |
#on_http_error(response) ⇒ Object
92 93 94 |
# File 'lib/soap/handsoap/ews_service.rb', line 92 def on_http_error(response) raise EwsLoginError, "Failed to login to EWS at #{uri}. Please check your credentials." if(response.status == 401) end |
#on_response_document(doc) ⇒ Object
Adds knowledge of namespaces to the response object. These have to be identical to the URIs returned in the XML response. For example, I had some issues with the ‘soap’ namespace because my original URI did not end in a ‘/’
78 79 80 81 82 |
# File 'lib/soap/handsoap/ews_service.rb', line 78 def on_response_document(doc) doc.add_namespace NS_SOAP, 'http://schemas.xmlsoap.org/soap/envelope/' doc.add_namespace NS_EWS_TYPES, 'http://schemas.microsoft.com/exchange/services/2006/types' doc.add_namespace NS_EWS_MESSAGES, 'http://schemas.microsoft.com/exchange/services/2006/messages' end |
#push_subscribe(folder_ids, event_types, url, watermark = nil, status_frequency = 5) ⇒ Object
Used to subscribe client applications to either push or pull notifications.
328 329 330 331 332 333 334 335 336 337 |
# File 'lib/soap/handsoap/ews_service.rb', line 328 def push_subscribe(folder_ids, event_types, url, watermark=nil, status_frequency=5) action = "#{SOAP_ACTION_PREFIX}/Subscribe" resp = invoke("#{NS_EWS_MESSAGES}:Subscribe", action) do |root| build!(root) do push_subscription_request!(folder_ids, event_types, url, watermark, status_frequency) end end parse!(resp) end |
#remove_delegate(owner, delegate) ⇒ Object
Removes one or more delegates from a user’s mailbox.
701 702 703 704 705 706 707 708 709 |
# File 'lib/soap/handsoap/ews_service.rb', line 701 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!(resp) end |
#resolve_names(name, full_contact_data = true, opts = {}) ⇒ Object
Resolve ambiguous e-mail addresses and display names
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/soap/handsoap/ews_service.rb', line 111 def resolve_names(name, full_contact_data = true, opts = {}) action = "#{SOAP_ACTION_PREFIX}/ResolveNames" resp = invoke("#{NS_EWS_MESSAGES}:ResolveNames", action) do |root| build!(root) do root.set_attr('ReturnFullContactData',full_contact_data) root.add("#{NS_EWS_MESSAGES}:UnresolvedEntry",name) end end parse!(resp) end |
#send_item(item_ids, save_item = true, saved_item_folder = nil) ⇒ Object
Used to send e-mail messages that are located in the Exchange store.
569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/soap/handsoap/ews_service.rb', line 569 def send_item(item_ids, save_item=true, saved_item_folder=nil) action = "#{SOAP_ACTION_PREFIX}/SendItem" resp = invoke("#{NS_EWS_MESSAGES}:SendItem", action) do |root| build!(root) do root.set_attr('SaveItemToFolder', save_item) item_ids!(root,item_ids) saved_item_folder_id!(root,saved_item_folder) unless saved_item_folder.nil? end end parse!(resp) end |
#set_user_oof_settings(mailbox, oof_state, ext_audience, dt_start, dt_end, int_msg, ext_mg) ⇒ Object
Sets a mailbox user’s Out of Office (OOF) settings and message.
753 754 755 756 757 758 759 |
# File 'lib/soap/handsoap/ews_service.rb', line 753 def set_user_oof_settings(mailbox, oof_state, ext_audience, dt_start, dt_end, int_msg, ext_mg) action = "#{SOAP_ACTION_PREFIX}/SetUserOofSettings" resp = invoke("#{NS_EWS_MESSAGES}:SetUserOofSettings", action) do |root| build!(root) end parse!(resp) end |
#subscribe(folder_ids, event_types, timeout = 10) ⇒ Object
Decide how/if to handle the optional SubscribeToAllFolders attribute of the PullSubscriptionRequest element.
Used to subscribe client applications to either push or pull notifications.
316 317 318 319 320 321 322 323 324 |
# File 'lib/soap/handsoap/ews_service.rb', line 316 def subscribe(folder_ids, event_types, timeout = 10) action = "#{SOAP_ACTION_PREFIX}/Subscribe" resp = invoke("#{NS_EWS_MESSAGES}:Subscribe", action) do |root| build!(root) do pull_subscription_request!(folder_ids, event_types, timeout) end end parse!(resp) end |
#sync_folder_hierarchy ⇒ Object
Defines a request to synchronize a folder hierarchy on a client
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/soap/handsoap/ews_service.rb', line 371 def sync_folder_hierarchy sync_state = nil folder_id = :publicfoldersroot action = "#{SOAP_ACTION_PREFIX}/SyncFolderHierarchy" resp = invoke("#{NS_EWS_MESSAGES}:SyncFolderHierarchy", action) do |root| build!(root) do folder_shape!(root, {:base_shape => 'Default'}) root.add("#{NS_EWS_MESSAGES}:SyncFolderId") do |sfid| folder_id!(sfid, folder_id) end sync_state!(root, sync_state) unless sync_state.nil? end end parse!(resp) end |
#sync_folder_items(folder_id, sync_state = nil, max_changes = 256, item_shape = {:base_shape => 'Default'}, opts = {}) ⇒ Object
Synchronizes items between the Exchange server and the client
402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/soap/handsoap/ews_service.rb', line 402 def sync_folder_items(folder_id, sync_state = nil, max_changes = 256, item_shape = {:base_shape => 'Default'}, opts = {}) action = "#{SOAP_ACTION_PREFIX}/SyncFolderItems" resp = invoke("#{NS_EWS_MESSAGES}:SyncFolderItems", action) do |root| build!(root) do item_shape!(root, item_shape) root.add("#{NS_EWS_MESSAGES}:SyncFolderId") do |sfid| folder_id!(sfid, folder_id) end sync_state!(root, sync_state) unless sync_state.nil? root.add("#{NS_EWS_MESSAGES}:MaxChangesReturned", max_changes) end end parse!(resp) end |
#unsubscribe(subscription_id) ⇒ Object
End a pull notification subscription.
343 344 345 346 347 348 349 350 351 |
# File 'lib/soap/handsoap/ews_service.rb', line 343 def unsubscribe(subscription_id) action = "#{SOAP_ACTION_PREFIX}/Unsubscribe" resp = invoke("#{NS_EWS_MESSAGES}:Unsubscribe", action) do |root| build!(root) do subscription_id!(root, subscription_id) end end parse!(resp) end |
#update_delegate(owner, delegate, permissions) ⇒ Object
Updates delegate permissions on a principal’s mailbox
718 719 720 721 722 723 724 725 726 |
# File 'lib/soap/handsoap/ews_service.rb', line 718 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!(resp) end |
#update_folder ⇒ Object
280 281 282 283 284 285 286 |
# File 'lib/soap/handsoap/ews_service.rb', line 280 def update_folder action = "#{SOAP_ACTION_PREFIX}/UpdateFolder" resp = invoke("#{NS_EWS_MESSAGES}:UpdateFolder", action) do |update_folder| build_update_folder!(update_folder) end parse_update_folder(resp) end |
#update_item(item_ids, changes, opts = {:message_disposition => 'SaveOnly', :conflict_resolution => 'AutoResolve'}) ⇒ Object
Used to modify the properties of an existing item in the Exchange store
548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'lib/soap/handsoap/ews_service.rb', line 548 def update_item(item_ids, changes, opts = {:message_disposition => 'SaveOnly', :conflict_resolution => 'AutoResolve'}) action = "#{SOAP_ACTION_PREFIX}/UpdateItem" resp = invoke("#{NS_EWS_MESSAGES}:UpdateItem", action) do |root| build!(root) do root.set_attr('MessageDisposition', opts[:message_disposition]) if opts.has_key?(:message_disposition) root.set_attr('ConflictResolution', opts[:conflict_resolution]) if opts.has_key?(:message_disposition) root.set_attr('SendMeetingInvitationsOrCancellations', opts[:send_meeting_invitations_or_cancellations]) if opts.has_key?(:send_meeting_invitations_or_cancellations) item_changes!(root, item_ids, changes) end end parse!(resp) end |