Module: Viewpoint::EWS::MailboxAccessors

Includes:
Viewpoint::EWS
Included in:
Viewpoint::EWSClient
Defined in:
lib/ews/mailbox_accessors.rb

Overview

This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.

Copyright © 2011 Dan Wanek <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Constant Summary

Constants included from Viewpoint::EWS

ConnectingSID

Instance Attribute Summary

Attributes included from Viewpoint::EWS

#logger

Instance Method Summary collapse

Methods included from Viewpoint::EWS

#remove_impersonation, root_logger, #set_impersonation

Instance Method Details

#get_user_availability(emails, opts) ⇒ Object

GetUserAvailability request

Parameters:

  • emails (Array<String>)

    A list of emails you want to retrieve free-busy info for.

  • opts (Hash)

Options Hash (opts):

  • :start_time (DateTime)
  • :end_time (DateTime)
  • :requested_view (Symbol)

    :merged_only/:free_busy/ :free_busy_merged/:detailed/:detailed_merged

  • :time_zone (Hash)

    The TimeZone data Example: => ‘UTC offset in minutes’, :standard_time => {:bias => 480, :time => ‘02:00:00’,

    :day_order => 5, :month => 10, :day_of_week => 'Sunday',
    

    :daylight_time => {same options as :standard_time}}

See Also:



57
58
59
60
61
62
# File 'lib/ews/mailbox_accessors.rb', line 57

def get_user_availability(emails, opts)
  opts = opts.clone
  args = get_user_availability_args(emails, opts)
  resp = ews.get_user_availability(args.merge(opts))
  get_user_availability_parser(resp)
end

#search_contacts(ustring) ⇒ Array<MailboxUser>

Resolve contacts in the Exchange Data Store

Parameters:

  • ustring (String)

    A string to resolve contacts to.

Returns:

  • (Array<MailboxUser>)

    It returns an Array of MailboxUsers.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ews/mailbox_accessors.rb', line 25

def search_contacts(ustring)
  resp = ews.resolve_names(:name => ustring)

  users = []
  if(resp.status == 'Success')
    mb = resp.response_message[:elems][:resolution_set][:elems][0][:resolution][:elems][0]
    users << Types::MailboxUser.new(ews, mb[:mailbox][:elems])
  elsif(resp.code == 'ErrorNameResolutionMultipleResults')
    resp.response_message[:elems][:resolution_set][:elems].each do |u|
    if u[:resolution][:elems][0][:mailbox]
      users << Types::MailboxUser.new(ews, u[:resolution][:elems][0][:mailbox][:elems])
    end
    end
  else
    raise EwsError, "Find User produced an error: #{resp.code}: #{resp.message}"
  end
  users
end