Method: Viewpoint::EWS::GenericFolder#get_items

Defined in:
lib/model/generic_folder.rb

#get_items(item_ids, change_key = nil, options = {}) ⇒ Object

Get Items

Parameters:

  • item_ids (String)

    is an array of Item IDs to fetch

  • change_key (String) (defaults to: nil)

    specify an optional change_key if you want to make sure you are fetching a specific version of the object.

  • options (String) (defaults to: {})

    specify an optional options hash. Supports the key :item_shape that expects a hash value with :base_shape and other optional parameters that specify the desired fields to return.



356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/model/generic_folder.rb', line 356

def get_items(item_ids, change_key = nil, options={})
  item_shape = options[:item_shape] ||
    {:base_shape => 'Default', :additional_properties => {:field_uRI => ['item:ParentFolderId']}}
  shallow = item_shape[:base_shape] != 'AllProperties'
  resp = (Viewpoint::EWS::EWS.instance).ews.get_item(item_ids, item_shape)
  if(resp.status == 'Success')
    resp.items.map do |item|
      type = item.keys.first
      eval "#{type.to_s.camel_case}.new(item[type], :shallow => #{shallow})"
    end
  else
    raise EwsError, "Could not retrieve items. #{resp.code}: #{resp.message}"
  end
end