viewpoint2 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +216 -0
  3. data/lib/ews/calendar_accessors.rb +34 -0
  4. data/lib/ews/connection.rb +130 -0
  5. data/lib/ews/connection_helper.rb +35 -0
  6. data/lib/ews/convert_accessors.rb +56 -0
  7. data/lib/ews/errors.rb +56 -0
  8. data/lib/ews/ews_client.rb +103 -0
  9. data/lib/ews/exceptions/exceptions.rb +61 -0
  10. data/lib/ews/folder_accessors.rb +264 -0
  11. data/lib/ews/impersonation.rb +30 -0
  12. data/lib/ews/item_accessors.rb +231 -0
  13. data/lib/ews/mailbox_accessors.rb +99 -0
  14. data/lib/ews/message_accessors.rb +93 -0
  15. data/lib/ews/push_subscription_accessors.rb +33 -0
  16. data/lib/ews/room_accessors.rb +48 -0
  17. data/lib/ews/roomlist_accessors.rb +47 -0
  18. data/lib/ews/soap.rb +64 -0
  19. data/lib/ews/soap/builders/ews_builder.rb +1351 -0
  20. data/lib/ews/soap/ews_response.rb +84 -0
  21. data/lib/ews/soap/ews_soap_availability_response.rb +58 -0
  22. data/lib/ews/soap/ews_soap_free_busy_response.rb +119 -0
  23. data/lib/ews/soap/ews_soap_response.rb +103 -0
  24. data/lib/ews/soap/ews_soap_room_response.rb +53 -0
  25. data/lib/ews/soap/ews_soap_roomlist_response.rb +54 -0
  26. data/lib/ews/soap/exchange_availability.rb +61 -0
  27. data/lib/ews/soap/exchange_data_services.rb +780 -0
  28. data/lib/ews/soap/exchange_notification.rb +146 -0
  29. data/lib/ews/soap/exchange_synchronization.rb +93 -0
  30. data/lib/ews/soap/exchange_time_zones.rb +56 -0
  31. data/lib/ews/soap/exchange_user_configuration.rb +33 -0
  32. data/lib/ews/soap/exchange_web_service.rb +264 -0
  33. data/lib/ews/soap/parsers/ews_parser.rb +43 -0
  34. data/lib/ews/soap/parsers/ews_sax_document.rb +70 -0
  35. data/lib/ews/soap/response_message.rb +80 -0
  36. data/lib/ews/soap/responses/create_attachment_response_message.rb +47 -0
  37. data/lib/ews/soap/responses/create_item_response_message.rb +25 -0
  38. data/lib/ews/soap/responses/find_item_response_message.rb +80 -0
  39. data/lib/ews/soap/responses/get_events_response_message.rb +53 -0
  40. data/lib/ews/soap/responses/send_notification_response_message.rb +59 -0
  41. data/lib/ews/soap/responses/subscribe_response_message.rb +35 -0
  42. data/lib/ews/soap/responses/sync_folder_hierarchy_response_message.rb +36 -0
  43. data/lib/ews/soap/responses/sync_folder_items_response_message.rb +36 -0
  44. data/lib/ews/templates/calendar_item.rb +79 -0
  45. data/lib/ews/templates/forward_item.rb +24 -0
  46. data/lib/ews/templates/message.rb +76 -0
  47. data/lib/ews/templates/reply_to_item.rb +25 -0
  48. data/lib/ews/templates/task.rb +74 -0
  49. data/lib/ews/types.rb +194 -0
  50. data/lib/ews/types/attachment.rb +77 -0
  51. data/lib/ews/types/attendee.rb +41 -0
  52. data/lib/ews/types/calendar_folder.rb +50 -0
  53. data/lib/ews/types/calendar_item.rb +133 -0
  54. data/lib/ews/types/contact.rb +7 -0
  55. data/lib/ews/types/contacts_folder.rb +8 -0
  56. data/lib/ews/types/copied_event.rb +51 -0
  57. data/lib/ews/types/created_event.rb +24 -0
  58. data/lib/ews/types/deleted_event.rb +24 -0
  59. data/lib/ews/types/distribution_list.rb +7 -0
  60. data/lib/ews/types/event.rb +62 -0
  61. data/lib/ews/types/export_items_response_message.rb +52 -0
  62. data/lib/ews/types/file_attachment.rb +65 -0
  63. data/lib/ews/types/folder.rb +60 -0
  64. data/lib/ews/types/free_busy_changed_event.rb +24 -0
  65. data/lib/ews/types/generic_folder.rb +418 -0
  66. data/lib/ews/types/item.rb +450 -0
  67. data/lib/ews/types/item_attachment.rb +84 -0
  68. data/lib/ews/types/item_field_uri_map.rb +208 -0
  69. data/lib/ews/types/mailbox_user.rb +156 -0
  70. data/lib/ews/types/meeting_cancellation.rb +7 -0
  71. data/lib/ews/types/meeting_message.rb +7 -0
  72. data/lib/ews/types/meeting_request.rb +7 -0
  73. data/lib/ews/types/meeting_response.rb +7 -0
  74. data/lib/ews/types/message.rb +7 -0
  75. data/lib/ews/types/modified_event.rb +48 -0
  76. data/lib/ews/types/moved_event.rb +51 -0
  77. data/lib/ews/types/new_mail_event.rb +24 -0
  78. data/lib/ews/types/out_of_office.rb +147 -0
  79. data/lib/ews/types/post_item.rb +7 -0
  80. data/lib/ews/types/search_folder.rb +8 -0
  81. data/lib/ews/types/status_event.rb +39 -0
  82. data/lib/ews/types/task.rb +104 -0
  83. data/lib/ews/types/tasks_folder.rb +27 -0
  84. data/lib/viewpoint/logging.rb +27 -0
  85. data/lib/viewpoint/logging/config.rb +24 -0
  86. data/lib/viewpoint/string_utils.rb +76 -0
  87. data/lib/viewpoint2.rb +111 -0
  88. metadata +191 -0
@@ -0,0 +1,208 @@
1
+ =begin
2
+ This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
3
+
4
+ Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ =end
18
+
19
+ module Viewpoint
20
+ module EWS
21
+ module ItemFieldUriMap
22
+
23
+ FIELD_URIS= {
24
+ :folder_id => {:text => 'folder:FolderId', :writable => true},
25
+ :total_count => {:text => 'folder:TotalCount', :writable => true},
26
+ :child_folder_count => {:text => 'folder:ChildFolderCount', :writable => true},
27
+ :folder_class => {:text => 'folder:FolderClass', :writable => true},
28
+ :search_parameters => {:text => 'folder:SearchParameters', :writable => true},
29
+ :managed_folder_information => {:text => 'folder:ManagedFolderInformation', :writable => true},
30
+ :permission_set => {:text => 'folder:PermissionSet', :writable => true},
31
+ :sharing_effective_rights => {:text => 'folder:SharingEffectiveRights', :writable => true},
32
+ :item_id => {:text => 'item:ItemId', :writable => true},
33
+ :parent_folder_id => {:text => 'item:ParentFolderId', :writable => true},
34
+ :item_class => {:text => 'item:ItemClass', :writable => true},
35
+ :mime_content => {:text => 'item:MimeContent', :writable => true},
36
+ :attachments => {:text => 'item:Attachments', :writable => true},
37
+ :subject => {:text => 'item:Subject', :writable => true},
38
+ :date_time_received => {:text => 'item:DateTimeReceived', :writable => true},
39
+ :in_reply_to => {:text => 'item:InReplyTo', :writable => true},
40
+ :internet_message_headers => {:text => 'item:InternetMessageHeaders', :writable => true},
41
+ :is_associated => {:text => 'item:IsAssociated', :writable => true},
42
+ :is_draft => {:text => 'item:IsDraft', :writable => true},
43
+ :is_from_me => {:text => 'item:IsFromMe', :writable => true},
44
+ :is_resend => {:text => 'item:IsResend', :writable => true},
45
+ :is_submitted => {:text => 'item:IsSubmitted', :writable => true},
46
+ :is_unmodified => {:text => 'item:IsUnmodified', :writable => true},
47
+ :date_time_sent => {:text => 'item:DateTimeSent', :writable => true},
48
+ :date_time_created => {:text => 'item:DateTimeCreated', :writable => true},
49
+ :body => {:text => 'item:Body', :writable => true},
50
+ :response_objects => {:text => 'item:ResponseObjects', :writable => true},
51
+ :sensitivity => {:text => 'item:Sensitivity', :writable => true},
52
+ :reminder_due_by => {:text => 'item:ReminderDueBy', :writable => true},
53
+ :reminder_is_set => {:text => 'item:ReminderIsSet', :writable => true},
54
+ :reminder_minutes_before_start => {:text => 'item:ReminderMinutesBeforeStart', :writable => true},
55
+ :display_to => {:text => 'item:DisplayTo', :writable => true},
56
+ :display_cc => {:text => 'item:DisplayCc', :writable => true},
57
+ :effective_rights => {:text => 'item:EffectiveRights', :writable => true},
58
+ :last_modified_name => {:text => 'item:LastModifiedName', :writable => true},
59
+ :last_modified_time => {:text => 'item:LastModifiedTime', :writable => true},
60
+ :unique_body => {:text => 'item:UniqueBody', :writable => true},
61
+ :web_client_read_form_query_string => {:text => 'item:WebClientReadFormQueryString', :writable => true},
62
+ :web_client_edit_form_query_string => {:text => 'item:WebClientEditFormQueryString', :writable => true},
63
+ :conversation_index => {:text => 'message:ConversationIndex', :writable => true},
64
+ :internet_message_id => {:text => 'message:InternetMessageId', :writable => true},
65
+ :is_read => {:text => 'message:IsRead', :writable => true},
66
+ :is_read_receipt_requested => {:text => 'message:IsReadReceiptRequested', :writable => true},
67
+ :is_delivery_receipt_requested => {:text => 'message:IsDeliveryReceiptRequested', :writable => true},
68
+ :references => {:text => 'message:References', :writable => true},
69
+ :reply_to => {:text => 'message:ReplyTo', :writable => true},
70
+ :from => {:text => 'message:From', :writable => true},
71
+ :sender => {:text => 'message:Sender', :writable => true},
72
+ :to_recipients => {:text => 'message:ToRecipients', :writable => true},
73
+ :cc_recipients => {:text => 'message:CcRecipients', :writable => true},
74
+ :bcc_recipients => {:text => 'message:BccRecipients', :writable => true},
75
+ :associated_calendar_item_id => {:text => 'meeting:AssociatedCalendarItemId', :writable => true},
76
+ :is_delegated => {:text => 'meeting:IsDelegated', :writable => true},
77
+ :is_out_of_date => {:text => 'meeting:IsOutOfDate', :writable => true},
78
+ :has_been_processed => {:text => 'meeting:HasBeenProcessed', :writable => true},
79
+ :response_type => {:text => 'meeting:ResponseType', :writable => true},
80
+ :meeting_request_type => {:text => 'meetingRequest:MeetingRequestType', :writable => true},
81
+ :intended_free_busy_status => {:text => 'meetingRequest:IntendedFreeBusyStatus', :writable => true},
82
+ :start => {:text => 'calendar:Start', :writable => true},
83
+ :end => {:text => 'calendar:End', :writable => true},
84
+ :original_start => {:text => 'calendar:OriginalStart', :writable => true},
85
+ :is_all_day_event => {:text => 'calendar:IsAllDayEvent', :writable => true},
86
+ :legacy_free_busy_status => {:text => 'calendar:LegacyFreeBusyStatus', :writable => true},
87
+ :location => {:text => 'calendar:Location', :writable => true},
88
+ :when => {:text => 'calendar:When', :writable => true},
89
+ :is_meeting => {:text => 'calendar:IsMeeting', :writable => true},
90
+ :is_cancelled => {:text => 'calendar:IsCancelled', :writable => true},
91
+ :meeting_request_was_sent => {:text => 'calendar:MeetingRequestWasSent', :writable => true},
92
+ :is_response_requested => {:text => 'calendar:IsResponseRequested', :writable => true},
93
+ :calendar_item_type => {:text => 'calendar:CalendarItemType', :writable => true},
94
+ :my_response_type => {:text => 'calendar:MyResponseType', :writable => true},
95
+ :organizer => {:text => 'calendar:Organizer', :writable => true},
96
+ :required_attendees => {:text => 'calendar:RequiredAttendees', :writable => true},
97
+ :optional_attendees => {:text => 'calendar:OptionalAttendees', :writable => true},
98
+ :resources => {:text => 'calendar:Resources', :writable => true},
99
+ :conflicting_meeting_count => {:text => 'calendar:ConflictingMeetingCount', :writable => true},
100
+ :adjacent_meeting_count => {:text => 'calendar:AdjacentMeetingCount', :writable => true},
101
+ :conflicting_meetings => {:text => 'calendar:ConflictingMeetings', :writable => true},
102
+ :adjacent_meetings => {:text => 'calendar:AdjacentMeetings', :writable => true},
103
+ :duration => {:text => 'calendar:Duration', :writable => true},
104
+ :time_zone => {:text => 'calendar:TimeZone', :writable => true},
105
+ :appointment_reply_time => {:text => 'calendar:AppointmentReplyTime', :writable => true},
106
+ :appointment_sequence_number => {:text => 'calendar:AppointmentSequenceNumber', :writable => true},
107
+ :appointment_state => {:text => 'calendar:AppointmentState', :writable => true},
108
+ :first_occurrence => {:text => 'calendar:FirstOccurrence', :writable => true},
109
+ :last_occurrence => {:text => 'calendar:LastOccurrence', :writable => true},
110
+ :modified_occurrences => {:text => 'calendar:ModifiedOccurrences', :writable => true},
111
+ :deleted_occurrences => {:text => 'calendar:DeletedOccurrences', :writable => true},
112
+ :meeting_time_zone => {:text => 'calendar:MeetingTimeZone', :writable => true},
113
+ :conference_type => {:text => 'calendar:ConferenceType', :writable => true},
114
+ :allow_new_time_proposal => {:text => 'calendar:AllowNewTimeProposal', :writable => true},
115
+ :is_online_meeting => {:text => 'calendar:IsOnlineMeeting', :writable => true},
116
+ :meeting_workspace_url => {:text => 'calendar:MeetingWorkspaceUrl', :writable => true},
117
+ :net_show_url => {:text => 'calendar:NetShowUrl', :writable => true},
118
+ :u_i_d => {:text => 'calendar:UID', :writable => true},
119
+ :recurrence_id => {:text => 'calendar:RecurrenceId', :writable => true},
120
+ :date_time_stamp => {:text => 'calendar:DateTimeStamp', :writable => true},
121
+ :start_time_zone => {:text => 'calendar:StartTimeZone', :writable => true},
122
+ :end_time_zone => {:text => 'calendar:EndTimeZone', :writable => true},
123
+ :actual_work => {:text => 'task:ActualWork', :writable => true},
124
+ :assigned_time => {:text => 'task:AssignedTime', :writable => true},
125
+ :billing_information => {:text => 'task:BillingInformation', :writable => true},
126
+ :change_count => {:text => 'task:ChangeCount', :writable => true},
127
+ :complete_date => {:text => 'task:CompleteDate', :writable => true},
128
+ :contacts => {:text => 'task:Contacts', :writable => true},
129
+ :delegation_state => {:text => 'task:DelegationState', :writable => true},
130
+ :delegator => {:text => 'task:Delegator', :writable => true},
131
+ :due_date => {:text => 'task:DueDate', :writable => true},
132
+ :is_assignment_editable => {:text => 'task:IsAssignmentEditable', :writable => true},
133
+ :is_complete => {:text => 'task:IsComplete', :writable => true},
134
+ :is_recurring => {:text => 'task:IsRecurring', :writable => true},
135
+ :is_team_task => {:text => 'task:IsTeamTask', :writable => true},
136
+ :owner => {:text => 'task:Owner', :writable => true},
137
+ :percent_complete => {:text => 'task:PercentComplete', :writable => true},
138
+ :recurrence => {:text => 'task:Recurrence', :writable => true},
139
+ :start_date => {:text => 'task:StartDate', :writable => true},
140
+ :status => {:text => 'task:Status', :writable => true},
141
+ :status_description => {:text => 'task:StatusDescription', :writable => true},
142
+ :total_work => {:text => 'task:TotalWork', :writable => true},
143
+ :assistant_name => {:text => 'contacts:AssistantName', :writable => true},
144
+ :birthday => {:text => 'contacts:Birthday', :writable => true},
145
+ :business_home_page => {:text => 'contacts:BusinessHomePage', :writable => true},
146
+ :children => {:text => 'contacts:Children', :writable => true},
147
+ :companies => {:text => 'contacts:Companies', :writable => true},
148
+ :company_name => {:text => 'contacts:CompanyName', :writable => true},
149
+ :complete_name => {:text => 'contacts:CompleteName', :writable => true},
150
+ :contact_source => {:text => 'contacts:ContactSource', :writable => true},
151
+ :culture => {:text => 'contacts:Culture', :writable => true},
152
+ :department => {:text => 'contacts:Department', :writable => true},
153
+ :display_name => {:text => 'contacts:DisplayName', :writable => true},
154
+ :email_addresses => {:ftype => :indexed_field_uRI, :text => 'contacts:EmailAddress', :writable => true},
155
+ :file_as => {:text => 'contacts:FileAs', :writable => true},
156
+ :file_as_mapping => {:text => 'contacts:FileAsMapping', :writable => true},
157
+ :generation => {:text => 'contacts:Generation', :writable => true},
158
+ :given_name => {:text => 'contacts:GivenName', :writable => true},
159
+ :has_picture => {:text => 'contacts:HasPicture', :writable => true},
160
+ :im_addresses => {:text => 'contacts:ImAddresses', :writable => true},
161
+ :initials => {:text => 'contacts:Initials', :writable => true},
162
+ :job_title => {:text => 'contacts:JobTitle', :writable => true},
163
+ :manager => {:text => 'contacts:Manager', :writable => true},
164
+ :middle_name => {:text => 'contacts:MiddleName', :writable => true},
165
+ :mileage => {:text => 'contacts:Mileage', :writable => true},
166
+ :nickname => {:text => 'contacts:Nickname', :writable => true},
167
+ :office_location => {:text => 'contacts:OfficeLocation', :writable => true},
168
+ :phone_numbers => {:ftype => :indexed_field_uRI, :text => 'contacts:PhoneNumber', :writable => true},
169
+ :physical_addresses => {:text => 'contacts:PhysicalAddresses', :writable => true},
170
+ :postal_address_index => {:text => 'contacts:PostalAddressIndex', :writable => true},
171
+ :profession => {:text => 'contacts:Profession', :writable => true},
172
+ :spouse_name => {:text => 'contacts:SpouseName', :writable => true},
173
+ :surname => {:text => 'contacts:Surname', :writable => true},
174
+ :wedding_anniversary => {:text => 'contacts:WeddingAnniversary', :writable => true},
175
+ :members => {:text => 'distributionlist:Members', :writable => true},
176
+ :posted_time => {:text => 'postitem:PostedTime', :writable => true},
177
+ :conversation_id => {:text => 'conversation:ConversationId', :writable => true},
178
+ :conversation_topic => {:text => 'conversation:ConversationTopic', :writable => true},
179
+ :unique_recipients => {:text => 'conversation:UniqueRecipients', :writable => true},
180
+ :global_unique_recipients => {:text => 'conversation:GlobalUniqueRecipients', :writable => true},
181
+ :unique_unread_senders => {:text => 'conversation:UniqueUnreadSenders', :writable => true},
182
+ :global_unique_unread_senders => {:text => 'conversation:GlobalUniqueUnreadSenders', :writable => true},
183
+ :unique_senders => {:text => 'conversation:UniqueSenders', :writable => true},
184
+ :global_unique_senders => {:text => 'conversation:GlobalUniqueSenders', :writable => true},
185
+ :last_delivery_time => {:text => 'conversation:LastDeliveryTime', :writable => true},
186
+ :global_last_delivery_time => {:text => 'conversation:GlobalLastDeliveryTime', :writable => true},
187
+ :categories => {:text => 'conversation:Categories', :writable => true},
188
+ :global_categories => {:text => 'conversation:GlobalCategories', :writable => true},
189
+ :flag_status => {:text => 'conversation:FlagStatus', :writable => true},
190
+ :global_flag_status => {:text => 'conversation:GlobalFlagStatus', :writable => true},
191
+ :has_attachments => {:text => 'conversation:HasAttachments', :writable => true},
192
+ :global_has_attachments => {:text => 'conversation:GlobalHasAttachments', :writable => true},
193
+ :message_count => {:text => 'conversation:MessageCount', :writable => true},
194
+ :global_message_count => {:text => 'conversation:GlobalMessageCount', :writable => true},
195
+ :unread_count => {:text => 'conversation:UnreadCount', :writable => true},
196
+ :global_unread_count => {:text => 'conversation:GlobalUnreadCount', :writable => true},
197
+ :size => {:text => 'conversation:Size', :writable => true},
198
+ :global_size => {:text => 'conversation:GlobalSize', :writable => true},
199
+ :item_classes => {:text => 'conversation:ItemClasses', :writable => true},
200
+ :global_item_classes => {:text => 'conversation:GlobalItemClasses', :writable => true},
201
+ :importance => {:text => 'conversation:Importance', :writable => true},
202
+ :global_importance => {:text => 'conversation:GlobalImportance', :writable => true},
203
+ :item_ids => {:text => 'conversation:ItemIds', :writable => true},
204
+ :global_item_ids => {:text => 'conversation:GlobalItemIds', :writable => true}
205
+ }
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,156 @@
1
+ =begin
2
+ This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
3
+
4
+ Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ =end
18
+
19
+ module Viewpoint::EWS::Types
20
+
21
+ # This represents a Mailbox object in the Exchange data store
22
+ # @see http://msdn.microsoft.com/en-us/library/aa565036.aspx MSDN docs
23
+ # @todo Design a Class method that resolves to an Array of MailboxUsers
24
+ class MailboxUser
25
+ include Viewpoint::EWS
26
+ include Viewpoint::EWS::Types
27
+
28
+ MAILBOX_KEY_PATHS = {
29
+ name: [:name],
30
+ email_address: [:email_address],
31
+ }
32
+ MAILBOX_KEY_TYPES = {}
33
+ MAILBOX_KEY_ALIAS = {
34
+ email: :email_address,
35
+ }
36
+
37
+ def initialize(ews, mbox_user)
38
+ @ews = ews
39
+ @ews_item = mbox_user
40
+ simplify!
41
+ end
42
+
43
+ def out_of_office_settings
44
+ mailbox = {:address => self.email_address}
45
+ resp = @ews.get_user_oof_settings(mailbox)
46
+ ewsi = resp.response.clone
47
+ ewsi.delete(:response_message)
48
+ return OutOfOffice.new(self,ewsi)
49
+ s = resp[:oof_settings]
50
+ @oof_state = s[:oof_state][:text]
51
+ @oof_ext_audience = s[:external_audience][:text]
52
+ @oof_start = DateTime.parse(s[:duration][:start_time][:text])
53
+ @oof_end = DateTime.parse(s[:duration][:end_time][:text])
54
+ @oof_internal_reply = s[:internal_reply][:message][:text]
55
+ @oof_external_reply = s[:internal_reply][:message][:text]
56
+ true
57
+ end
58
+
59
+ # Get information about when the user with the given email address is available.
60
+ # @param [String] email_address The email address of the person to find availability for.
61
+ # @param [DateTime] start_time The start of the time range to check as an xs:dateTime.
62
+ # @param [DateTime] end_time The end of the time range to check as an xs:dateTime.
63
+ # @see http://msdn.microsoft.com/en-us/library/aa563800(v=exchg.140)
64
+ def get_user_availability(email_address, start_time, end_time)
65
+ opts = {
66
+ mailbox_data: [ :email =>{:address => email_address} ],
67
+ free_busy_view_options: {
68
+ time_window: {start_time: start_time, end_time: end_time},
69
+ }
70
+ }
71
+ resp = (Viewpoint::EWS::EWS.instance).ews.get_user_availability(opts)
72
+ if(resp.status == 'Success')
73
+ return resp.items
74
+ else
75
+ raise EwsError, "GetUserAvailability produced an error: #{resp.code}: #{resp.message}"
76
+ end
77
+ end
78
+
79
+ # Adds one or more delegates to a principal's mailbox and sets specific access permissions
80
+ # @see http://msdn.microsoft.com/en-us/library/bb856527.aspx
81
+ #
82
+ # @param [String,MailboxUser] delegate_email The user you would like to give delegate access to.
83
+ # This can either be a simple String e-mail address or you can pass in a MailboxUser object.
84
+ # @param [Hash] permissions A hash of folder type keys and permission type values. An example
85
+ # would be {:calendar_folder_permission_level => 'Editor'}. Possible keys are:
86
+ # :calendar_folder_permission_level, :tasks_folder_permission_level, :inbox_folder_permission_level
87
+ # :contacts_folder_permission_level, :notes_folder_permission_level, :journal_folder_permission_level
88
+ # and possible values are: None/Editor/Reviewer/Author/Custom
89
+ # @return [true] This method either returns true or raises an error with the message
90
+ # as to why this operation did not succeed.
91
+ def add_delegate!(delegate_email, permissions)
92
+ # Use a new hash so the passed hash is not modified in case we are in a loop.
93
+ # Thanks to Markus Roberts for pointing this out.
94
+ formatted_perms = {}
95
+ # Modify permissions so we can pass it to the builders
96
+ permissions.each_pair do |k,v|
97
+ formatted_perms[k] = {:text => v}
98
+ end
99
+
100
+ resp = (Viewpoint::EWS::EWS.instance).ews.add_delegate(self.email_address, delegate_email, formatted_perms)
101
+ if(resp.status == 'Success')
102
+ return true
103
+ else
104
+ raise EwsError, "Could not add delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}"
105
+ end
106
+ end
107
+
108
+ def update_delegate!(delegate_email, permissions)
109
+ # Modify permissions so we can pass it to the builders
110
+ formatted_perms = {}
111
+ permissions.each_pair do |k,v|
112
+ formatted_perms[k] = {:text => v}
113
+ end
114
+
115
+ resp = (Viewpoint::EWS::EWS.instance).ews.update_delegate(self.email_address, delegate_email, formatted_perms)
116
+ if(resp.status == 'Success')
117
+ return true
118
+ else
119
+ raise EwsError, "Could not update delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}"
120
+ end
121
+ end
122
+
123
+ def get_delegate_info()
124
+ resp = (Viewpoint::EWS::EWS.instance).ews.get_delegate(self.email_address)
125
+ # if(resp.status == 'Success')
126
+ # return true
127
+ # else
128
+ # raise EwsError, "Could not update delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}"
129
+ # end
130
+ end
131
+
132
+
133
+ private
134
+
135
+
136
+ def simplify!
137
+ @ews_item = @ews_item.inject({}){|m,o|
138
+ m[o.keys.first] = o.values.first[:text];
139
+ m
140
+ }
141
+ end
142
+
143
+ def key_paths
144
+ @key_paths ||= super.merge(MAILBOX_KEY_PATHS)
145
+ end
146
+
147
+ def key_types
148
+ @key_types ||= super.merge(MAILBOX_KEY_TYPES)
149
+ end
150
+
151
+ def key_alias
152
+ @key_alias ||= super.merge(MAILBOX_KEY_ALIAS)
153
+ end
154
+
155
+ end # MailboxUser
156
+ end # Viewpoint::EWS::Types
@@ -0,0 +1,7 @@
1
+ module Viewpoint::EWS::Types
2
+ class MeetingCancellation
3
+ include Viewpoint::EWS
4
+ include Viewpoint::EWS::Types
5
+ include Viewpoint::EWS::Types::Item
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Viewpoint::EWS::Types
2
+ class MeetingMessage
3
+ include Viewpoint::EWS
4
+ include Viewpoint::EWS::Types
5
+ include Viewpoint::EWS::Types::Item
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Viewpoint::EWS::Types
2
+ class MeetingRequest
3
+ include Viewpoint::EWS
4
+ include Viewpoint::EWS::Types
5
+ include Viewpoint::EWS::Types::Item
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Viewpoint::EWS::Types
2
+ class MeetingResponse
3
+ include Viewpoint::EWS
4
+ include Viewpoint::EWS::Types
5
+ include Viewpoint::EWS::Types::Item
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Viewpoint::EWS::Types
2
+ class Message
3
+ include Viewpoint::EWS
4
+ include Viewpoint::EWS::Types
5
+ include Viewpoint::EWS::Types::Item
6
+ end
7
+ end
@@ -0,0 +1,48 @@
1
+ =begin
2
+ This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
3
+
4
+ Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ =end
18
+
19
+ module Viewpoint::EWS::Types
20
+
21
+ class ModifiedEvent < Event
22
+
23
+ MODIFIED_EVENT_KEY_PATHS = {
24
+ }
25
+
26
+ MODIFIED_EVENT_KEY_TYPES = {
27
+ }
28
+
29
+ MODIFIED_EVENT_KEY_ALIAS = { }
30
+
31
+
32
+ private
33
+
34
+
35
+ def key_paths
36
+ @key_paths ||= super.merge MODIFIED_EVENT_KEY_PATHS
37
+ end
38
+
39
+ def key_types
40
+ @key_types ||= super.merge MODIFIED_EVENT_KEY_TYPES
41
+ end
42
+
43
+ def key_alias
44
+ @key_alias ||= super.merge MODIFIED_EVENT_KEY_ALIAS
45
+ end
46
+
47
+ end
48
+ end