Module: Viewpoint::EWS::ItemAccessors
- Includes:
- Viewpoint::EWS
- Included in:
- Types::GenericFolder, Viewpoint::EWSClient
- Defined in:
- lib/ews/item_accessors.rb
Overview
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright
Constant Summary
Constants included from Viewpoint::EWS
Instance Attribute Summary
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
-
#copy_items(items, folder) ⇒ Array<Hash>
Copy an array of items to the specified folder.
-
#export_items(item_ids) ⇒ Object
Exports an entire item into base64 string return [Array] array of bulk items.
- #find_items(opts = {}) {|obj| ... } ⇒ Object
-
#get_item(item_id, opts = {}) {|obj| ... } ⇒ Item
This is a class method that fetches an existing Item from the Exchange Store.
-
#get_items(item_ids, opts = {}) {|obj| ... } ⇒ Item
This is a class method that fetches an existing Item from the Exchange Store.
-
#move_items(items, folder) ⇒ Object
Move an array of items to the specified folder.
Methods included from Viewpoint::EWS
#remove_impersonation, root_logger, #set_impersonation
Instance Method Details
#copy_items(items, folder) ⇒ Array<Hash>
Copy an array of items to the specified folder
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ews/item_accessors.rb', line 75 def copy_items(items, folder) folder = folder.id if folder.kind_of?(Types::GenericFolder) item_ids = items.collect{|i| {item_id: {id: i.id, change_key: i.change_key}}} copy_opts = { :to_folder_id => {:id => folder}, :item_ids => item_ids } resp = ews.copy_item(copy_opts) copy_move_items_parser(resp) end |
#export_items(item_ids) ⇒ Object
Exports an entire item into base64 string return [Array] array of bulk items
102 103 104 105 106 107 |
# File 'lib/ews/item_accessors.rb', line 102 def export_items(item_ids) args = export_items_args(item_ids) resp = ews.export_items(args) export_items_parser(resp) end |
#find_items(opts = {}) {|obj| ... } ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/ews/item_accessors.rb', line 40 def find_items(opts = {}) args = find_items_args(opts.clone) obj = OpenStruct.new(opts: args, restriction: {}) yield obj if block_given? merge_restrictions! obj resp = ews.find_item(args) find_items_parser resp end |
#get_item(item_id, opts = {}) {|obj| ... } ⇒ Item
Add support to fetch an item with a ChangeKey
This is a class method that fetches an existing Item from the
Exchange Store.
29 30 31 32 33 34 35 |
# File 'lib/ews/item_accessors.rb', line 29 def get_item(item_id, opts = {}) args = get_item_args(item_id, opts.clone) obj = OpenStruct.new(opts: args) yield obj if block_given? resp = ews.get_item(args) get_item_parser(resp) end |
#get_items(item_ids, opts = {}) {|obj| ... } ⇒ Item
Add support to fetch an item with a ChangeKey
This is a class method that fetches an existing Item from the
Exchange Store.
57 58 59 60 61 62 63 |
# File 'lib/ews/item_accessors.rb', line 57 def get_items(item_ids, opts = {}) args = get_item_args(item_ids, opts.clone) obj = OpenStruct.new(opts: args) yield obj if block_given? resp = ews.get_item(args) get_items_parser(resp) end |
#move_items(items, folder) ⇒ Object
Move an array of items to the specified folder
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ews/item_accessors.rb', line 88 def move_items(items, folder) folder = folder.id if folder.kind_of?(Types::GenericFolder) item_ids = items.collect{|i| {item_id: {id: i.id, change_key: i.change_key}}} move_opts = { :to_folder_id => {:id => folder}, :item_ids => item_ids } resp = ews.move_item(move_opts) copy_move_items_parser(resp, :move_item_response_message) end |