| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package EWS::Calendar::Role::RetrieveWithinWindow; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
912
|
$EWS::Calendar::Role::RetrieveWithinWindow::VERSION = '1.143070'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
1
|
|
|
1
|
|
6
|
use Moose::Role; |
|
|
1
|
|
|
|
|
43
|
|
|
|
1
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6225
|
use EWS::Calendar::ResultSet; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
40
|
|
|
8
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
790
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _list_messages { |
|
11
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
|
12
|
0
|
|
|
|
|
|
return @{ $response->{"${kind}Result"} |
|
13
|
|
|
|
|
|
|
->{ResponseMessages} |
|
14
|
0
|
|
|
|
|
|
->{cho_CreateItemResponseMessage} }; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _check_for_errors { |
|
18
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response, $opts) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
croak "Fault returned from Exchange Server: ($opts->{impersonate}) $response->{Fault}->{faultstring}\n" |
|
21
|
0
|
0
|
|
|
|
|
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
|
|
|
|
|
|
return map { $_->{CalendarItem} } |
|
33
|
0
|
0
|
|
|
|
|
map { @{ $_->{Items}->{cho_Item} || [] } } |
|
|
0
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
map { exists $_->{RootFolder} ? $_->{RootFolder} : $_ } |
|
35
|
0
|
|
|
|
|
|
map { $_->{"${kind}ResponseMessage"} } |
|
|
0
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
my $find_response = scalar $self->client->FindItem->( |
|
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
|
0
|
0
|
|
|
|
|
); |
|
|
|
0
|
|
|
|
|
|
|
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
|
|
|
|
|
|
my @items; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Exchange (at least versions 2007,2010) have a limit of 250 items for a |
|
90
|
|
|
|
|
|
|
# GetItem call. To be safe, we just pull 200 items at a time until we fetch |
|
91
|
|
|
|
|
|
|
# everything |
|
92
|
0
|
|
|
|
|
|
while (@ids) { |
|
93
|
|
|
|
|
|
|
my $get_response = scalar $self->client->GetItem->( |
|
94
|
|
|
|
|
|
|
(exists $opts->{impersonate} ? ( |
|
95
|
|
|
|
|
|
|
Impersonation => { |
|
96
|
|
|
|
|
|
|
ConnectingSID => { |
|
97
|
|
|
|
|
|
|
PrimarySmtpAddress => $opts->{impersonate}, |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
}, |
|
100
|
|
|
|
|
|
|
) : ()), |
|
101
|
|
|
|
|
|
|
RequestVersion => { |
|
102
|
|
|
|
|
|
|
Version => $self->client->server_version, |
|
103
|
|
|
|
|
|
|
}, |
|
104
|
|
|
|
|
|
|
ItemShape => { |
|
105
|
|
|
|
|
|
|
BaseShape => 'IdOnly', |
|
106
|
|
|
|
|
|
|
AdditionalProperties => { |
|
107
|
|
|
|
|
|
|
cho_Path => [ |
|
108
|
|
|
|
|
|
|
map {{ |
|
109
|
0
|
|
|
|
|
|
FieldURI => { |
|
110
|
|
|
|
|
|
|
FieldURI => $_, |
|
111
|
|
|
|
|
|
|
}, |
|
112
|
|
|
|
|
|
|
}} qw/ |
|
113
|
|
|
|
|
|
|
calendar:Start |
|
114
|
|
|
|
|
|
|
calendar:End |
|
115
|
|
|
|
|
|
|
item:Subject |
|
116
|
|
|
|
|
|
|
calendar:Location |
|
117
|
|
|
|
|
|
|
calendar:CalendarItemType |
|
118
|
|
|
|
|
|
|
calendar:Organizer |
|
119
|
|
|
|
|
|
|
item:Sensitivity |
|
120
|
|
|
|
|
|
|
item:DisplayTo |
|
121
|
|
|
|
|
|
|
calendar:AppointmentState |
|
122
|
|
|
|
|
|
|
calendar:IsAllDayEvent |
|
123
|
|
|
|
|
|
|
calendar:LegacyFreeBusyStatus |
|
124
|
|
|
|
|
|
|
item:IsDraft |
|
125
|
|
|
|
|
|
|
item:Body |
|
126
|
|
|
|
|
|
|
calendar:OptionalAttendees |
|
127
|
|
|
|
|
|
|
calendar:RequiredAttendees |
|
128
|
|
|
|
|
|
|
calendar:Duration |
|
129
|
|
|
|
|
|
|
calendar:UID |
|
130
|
|
|
|
|
|
|
/, |
|
131
|
|
|
|
|
|
|
], |
|
132
|
|
|
|
|
|
|
}, |
|
133
|
|
|
|
|
|
|
}, |
|
134
|
|
|
|
|
|
|
ItemIds => { |
|
135
|
|
|
|
|
|
|
cho_ItemId => [ |
|
136
|
0
|
0
|
|
|
|
|
map {{ |
|
137
|
0
|
|
|
|
|
|
ItemId => { Id => $_ }, |
|
138
|
|
|
|
|
|
|
}} splice(@ids, 0, 200) |
|
139
|
|
|
|
|
|
|
], |
|
140
|
|
|
|
|
|
|
}, |
|
141
|
|
|
|
|
|
|
); |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
$self->_check_for_errors('GetItem', $get_response, $opts); |
|
144
|
0
|
|
|
|
|
|
push(@items, $self->_list_calendaritems('GetItem', $get_response)); |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
return EWS::Calendar::ResultSet->new({ items => [ @items ] }); |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
1
|
|
|
1
|
|
6
|
no Moose::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
151
|
|
|
|
|
|
|
1; |
|
152
|
|
|
|
|
|
|
|