line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EWS::Calendar::Role::RetrieveWithinWindow; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
712
|
$EWS::Calendar::Role::RetrieveWithinWindow::VERSION = '1.143070'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
6
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5389
|
use EWS::Calendar::ResultSet; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
66
|
|
8
|
1
|
|
|
1
|
|
13
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
915
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _list_messages { |
11
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
12
|
0
|
|
|
|
|
|
return @{ $response->{"${kind}Result"} |
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
->{ResponseMessages} |
14
|
|
|
|
|
|
|
->{cho_CreateItemResponseMessage} }; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _check_for_errors { |
18
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response, $opts) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
croak "Fault returned from Exchange Server: ($opts->{impersonate}) $response->{Fault}->{faultstring}\n" |
21
|
|
|
|
|
|
|
if ( exists $response->{Fault} ); |
22
|
0
|
|
|
|
|
|
foreach my $msg ( $self->_list_messages($kind, $response) ) { |
23
|
0
|
|
0
|
|
|
|
my $code = $msg->{"${kind}ResponseMessage"}->{ResponseCode} || ''; |
24
|
0
|
0
|
|
|
|
|
croak "Fault returned from Exchange Server: ($opts->{impersonate}) $code\n" |
25
|
|
|
|
|
|
|
if $code ne 'NoError'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _list_calendaritems { |
30
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
return map { $_->{CalendarItem} } |
|
0
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
map { @{ $_->{Items}->{cho_Item} || [] } } |
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
map { exists $_->{RootFolder} ? $_->{RootFolder} : $_ } |
35
|
0
|
|
|
|
|
|
map { $_->{"${kind}ResponseMessage"} } |
36
|
|
|
|
|
|
|
$self->_list_messages($kind, $response); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Find list of items within the view, then Get details for each one |
40
|
|
|
|
|
|
|
# (item:Body is only available this way, it's not returned by FindItem) |
41
|
|
|
|
|
|
|
sub retrieve_within_window { |
42
|
0
|
|
|
0
|
0
|
|
my ($self, $opts) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
my $find_response = scalar $self->client->FindItem->( |
|
|
0
|
|
|
|
|
|
45
|
|
|
|
|
|
|
(exists $opts->{impersonate} ? ( |
46
|
|
|
|
|
|
|
Impersonation => { |
47
|
|
|
|
|
|
|
ConnectingSID => { |
48
|
|
|
|
|
|
|
PrimarySmtpAddress => $opts->{impersonate}, |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
) : ()), |
52
|
|
|
|
|
|
|
RequestVersion => { |
53
|
|
|
|
|
|
|
Version => $self->client->server_version, |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
Traversal => 'Shallow', |
56
|
|
|
|
|
|
|
ItemShape => { |
57
|
|
|
|
|
|
|
BaseShape => 'IdOnly', |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
ParentFolderIds => { |
60
|
|
|
|
|
|
|
cho_FolderId => [ |
61
|
|
|
|
|
|
|
{ DistinguishedFolderId => |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
Id => "calendar", |
64
|
|
|
|
|
|
|
(exists $opts->{email} ? ( |
65
|
|
|
|
|
|
|
Mailbox => { |
66
|
|
|
|
|
|
|
EmailAddress => $opts->{email}, |
67
|
|
|
|
|
|
|
}, |
68
|
|
|
|
|
|
|
) : ()), # optional |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
}, |
71
|
|
|
|
|
|
|
], |
72
|
|
|
|
|
|
|
}, |
73
|
|
|
|
|
|
|
CalendarView => { |
74
|
|
|
|
|
|
|
StartDate => $opts->{window}->start->iso8601, |
75
|
|
|
|
|
|
|
EndDate => $opts->{window}->end->iso8601, |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
return EWS::Calendar::ResultSet->new({items => []}) |
80
|
|
|
|
|
|
|
if !defined $find_response; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$self->_check_for_errors('FindItem', $find_response, $opts); |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my @ids = map { $_->{ItemId}->{Id} } |
|
0
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$self->_list_calendaritems('FindItem', $find_response); |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
return EWS::Calendar::ResultSet->new({items => []}) |
88
|
|
|
|
|
|
|
if scalar @ids == 0; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $get_response = scalar $self->client->GetItem->( |
91
|
|
|
|
|
|
|
(exists $opts->{impersonate} ? ( |
92
|
|
|
|
|
|
|
Impersonation => { |
93
|
|
|
|
|
|
|
ConnectingSID => { |
94
|
|
|
|
|
|
|
PrimarySmtpAddress => $opts->{impersonate}, |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
}, |
97
|
|
|
|
|
|
|
) : ()), |
98
|
|
|
|
|
|
|
RequestVersion => { |
99
|
|
|
|
|
|
|
Version => $self->client->server_version, |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
ItemShape => { |
102
|
|
|
|
|
|
|
BaseShape => 'IdOnly', |
103
|
|
|
|
|
|
|
AdditionalProperties => { |
104
|
|
|
|
|
|
|
cho_Path => [ |
105
|
0
|
|
|
|
|
|
map {{ |
106
|
|
|
|
|
|
|
FieldURI => { |
107
|
|
|
|
|
|
|
FieldURI => $_, |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
}} qw/ |
110
|
|
|
|
|
|
|
calendar:Start |
111
|
|
|
|
|
|
|
calendar:End |
112
|
|
|
|
|
|
|
item:Subject |
113
|
|
|
|
|
|
|
calendar:Location |
114
|
|
|
|
|
|
|
calendar:CalendarItemType |
115
|
|
|
|
|
|
|
calendar:Organizer |
116
|
|
|
|
|
|
|
item:Sensitivity |
117
|
|
|
|
|
|
|
item:DisplayTo |
118
|
|
|
|
|
|
|
calendar:AppointmentState |
119
|
|
|
|
|
|
|
calendar:IsAllDayEvent |
120
|
|
|
|
|
|
|
calendar:LegacyFreeBusyStatus |
121
|
|
|
|
|
|
|
item:IsDraft |
122
|
|
|
|
|
|
|
item:Body |
123
|
|
|
|
|
|
|
calendar:OptionalAttendees |
124
|
|
|
|
|
|
|
calendar:RequiredAttendees |
125
|
|
|
|
|
|
|
calendar:Duration |
126
|
|
|
|
|
|
|
calendar:UID |
127
|
|
|
|
|
|
|
/, |
128
|
|
|
|
|
|
|
], |
129
|
|
|
|
|
|
|
}, |
130
|
|
|
|
|
|
|
}, |
131
|
|
|
|
|
|
|
ItemIds => { |
132
|
|
|
|
|
|
|
cho_ItemId => [ |
133
|
0
|
0
|
|
|
|
|
map {{ |
134
|
|
|
|
|
|
|
ItemId => { Id => $_ }, |
135
|
|
|
|
|
|
|
}} @ids |
136
|
|
|
|
|
|
|
], |
137
|
|
|
|
|
|
|
}, |
138
|
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
$self->_check_for_errors('GetItem', $get_response, $opts); |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return EWS::Calendar::ResultSet->new({ |
143
|
|
|
|
|
|
|
items => [ $self->_list_calendaritems('GetItem', $get_response) ] |
144
|
|
|
|
|
|
|
}); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
1
|
|
|
1
|
|
9
|
no Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
148
|
|
|
|
|
|
|
1; |
149
|
|
|
|
|
|
|
|