Module: Viewpoint::EWS::FolderAccessors
Overview
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
Copyright
Constant Summary collapse
- FOLDER_TYPE_MAP =
{ :mail => 'IPF.Note', :calendar => 'IPF.Appointment', :task => 'IPF.Task', }
Constants included from Viewpoint::EWS
Instance Attribute Summary
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
-
#folders(opts = {}) {|obj| ... } ⇒ Array
(also: #find_folders)
Find subfolders of the passed root folder.
-
#get_folder(folder_id, opts = {}) ⇒ Object
Get a specific folder by id or symbol.
-
#get_folder_by_name(name, opts = {}) ⇒ Object
Get a specific folder by its name.
- #make_folder(name, opts = {}) ⇒ Object (also: #mkfolder)
-
#sync_folders(opts = {}) {|Hash| ... } ⇒ Hash
Get a specific folder by id or symbol.
Methods included from Viewpoint::EWS
#remove_impersonation, root_logger, #set_impersonation
Instance Method Details
#folders(opts = {}) {|obj| ... } ⇒ Array Also known as: find_folders
Find subfolders of the passed root folder. If no parameters are passed this method will search from the Root folder.
39 40 41 42 43 44 45 46 47 |
# File 'lib/ews/folder_accessors.rb', line 39 def folders(opts={}) opts = opts.clone args = find_folders_args(opts) obj = OpenStruct.new(opts: args, restriction: {}) yield obj if block_given? merge_restrictions! obj resp = ews.find_folder( args ) find_folders_parser(resp) end |
#get_folder(folder_id, opts = {}) ⇒ Object
Get a specific folder by id or symbol
59 60 61 62 63 64 |
# File 'lib/ews/folder_accessors.rb', line 59 def get_folder(folder_id, opts = {}) opts = opts.clone args = get_folder_args(folder_id, opts) resp = ews.get_folder(args) get_folder_parser(resp) end |
#get_folder_by_name(name, opts = {}) ⇒ Object
Get a specific folder by its name
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ews/folder_accessors.rb', line 75 def get_folder_by_name(name, opts={}) opts = opts.clone opts[:root] = opts.delete(:parent) folders(opts) do |obj| obj.restriction = { :is_equal_to => [ {:field_uRI => {:field_uRI=>'folder:DisplayName'}}, {:field_uRI_or_constant => {:constant => {:value=>name}}} ] } end.first end |
#make_folder(name, opts = {}) ⇒ Object Also known as: mkfolder
96 97 98 99 100 101 |
# File 'lib/ews/folder_accessors.rb', line 96 def make_folder(name, opts={}) parent = opts[:parent] || :msgfolderroot resp = ews.create_folder :parent_folder_id => {:id => parent}, :folders => [folder_type(opts[:type]) => {:display_name => name}] create_folder_parser(resp).first end |
#sync_folders(opts = {}) {|Hash| ... } ⇒ Hash
Get a specific folder by id or symbol
121 122 123 124 125 126 127 |
# File 'lib/ews/folder_accessors.rb', line 121 def sync_folders(opts = {}) opts = opts.clone args = sync_folders_args(opts) yield args if block_given? resp = ews.sync_folder_hierarchy( args ) sync_folders_parser(resp) end |