line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EWS::Folder::Role::Reader; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
729
|
$EWS::Folder::Role::Reader::VERSION = '1.143070'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
10
|
use Moose::Role; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
7
|
1
|
|
|
1
|
|
5586
|
use EWS::Folder::ResultSet; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
8
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
9
|
1
|
|
|
1
|
|
814
|
use Data::Dumper; |
|
1
|
|
|
|
|
4759
|
|
|
1
|
|
|
|
|
740
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _list_messages { |
12
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
13
|
0
|
0
|
|
|
|
|
if ( $response->{Fault} ) { |
14
|
0
|
|
|
|
|
|
my $msg; |
15
|
0
|
|
|
|
|
|
$msg->{"${kind}ResponseMessage"}->{ResponseCode} = $response->{Fault}->{faultstring}; |
16
|
0
|
|
|
|
|
|
return $msg; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else { |
19
|
0
|
|
|
|
|
|
return @{ $response->{"${kind}Result"} |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
->{ResponseMessages} |
21
|
|
|
|
|
|
|
->{"cho_CreateItemResponseMessage"} }; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _check_for_errors { |
26
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
foreach my $msg ( $self->_list_messages($kind, $response) ) { |
29
|
0
|
|
0
|
|
|
|
my $code = $msg->{"${kind}ResponseMessage"}->{ResponseCode} || ''; |
30
|
0
|
0
|
|
|
|
|
croak "Fault returned from Exchange Server: $code\n" |
31
|
|
|
|
|
|
|
if $code ne 'NoError'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _PagingOffset { |
36
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
foreach my $msg ( $self->_list_messages($kind, $response) ) { |
39
|
0
|
0
|
|
|
|
|
if ( exists $msg->{"${kind}ResponseMessage"}->{RootFolder} ) { |
40
|
0
|
0
|
|
|
|
|
if ( ! $msg->{"${kind}ResponseMessage"}->{RootFolder}->{IncludesLastItemInRange} ) { |
41
|
0
|
|
|
|
|
|
return $msg->{"${kind}ResponseMessage"}->{RootFolder}->{IndexedPagingOffset}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
return 0; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _list_folderitems { |
49
|
0
|
|
|
0
|
|
|
my ($self, $kind, $response) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return map { exists $_->{Folder} ? $_->{Folder} : $_ } |
|
0
|
0
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
map { exists $_->{TasksFolder} ? $_->{TasksFolder} : $_ } |
53
|
0
|
0
|
|
|
|
|
map { exists $_->{ContactsFolder} ? $_->{ContactsFolder} : $_ } |
54
|
0
|
0
|
|
|
|
|
map { exists $_->{CalendarFolder} ? $_->{CalendarFolder} : $_ } |
55
|
0
|
0
|
|
|
|
|
map { @{ $_->{Folders}->{cho_Folder} || [] } } |
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
map { exists $_->{RootFolder} ? $_->{RootFolder} : $_ } |
57
|
0
|
|
|
|
|
|
map { $_->{"${kind}ResponseMessage"} } |
58
|
|
|
|
|
|
|
$self->_list_messages($kind, $response); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Find list of items within the view, then Get details for each one |
62
|
|
|
|
|
|
|
# (item:Body is only available this way, it's not returned by FindItem) |
63
|
|
|
|
|
|
|
sub retrieve{ |
64
|
0
|
|
|
0
|
0
|
|
my ($self, $opts) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my @items; |
67
|
0
|
|
|
|
|
|
my $IndexedPagingOffset = 0; |
68
|
0
|
|
|
|
|
|
do { |
69
|
|
|
|
|
|
|
# Find all folders underneath the 'Top of Information Store' |
70
|
0
|
|
|
|
|
|
my $find_response = scalar $self->client->FindFolder->( |
71
|
|
|
|
|
|
|
(exists $opts->{impersonate} ? ( |
72
|
|
|
|
|
|
|
Impersonation => { |
73
|
|
|
|
|
|
|
ConnectingSID => { |
74
|
|
|
|
|
|
|
PrimarySmtpAddress => $opts->{impersonate}, |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
) : ()), |
78
|
|
|
|
|
|
|
RequestVersion => { |
79
|
|
|
|
|
|
|
Version => $self->client->server_version, |
80
|
|
|
|
|
|
|
}, |
81
|
|
|
|
|
|
|
Traversal => 'Deep', |
82
|
|
|
|
|
|
|
FolderShape => { |
83
|
|
|
|
|
|
|
BaseShape => 'IdOnly', |
84
|
|
|
|
|
|
|
AdditionalProperties => { |
85
|
|
|
|
|
|
|
cho_Path => [ |
86
|
|
|
|
|
|
|
{ExtendedFieldURI => { |
87
|
|
|
|
|
|
|
PropertyTag => '3592', |
88
|
|
|
|
|
|
|
PropertyType => 'Integer', |
89
|
|
|
|
|
|
|
}}, |
90
|
0
|
0
|
|
|
|
|
map {{ |
|
|
0
|
|
|
|
|
|
91
|
|
|
|
|
|
|
FieldURI => { |
92
|
|
|
|
|
|
|
FieldURI => $_, |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
}} qw/ |
95
|
|
|
|
|
|
|
folder:DisplayName |
96
|
|
|
|
|
|
|
folder:FolderClass |
97
|
|
|
|
|
|
|
folder:ChildFolderCount |
98
|
|
|
|
|
|
|
folder:TotalCount |
99
|
|
|
|
|
|
|
folder:ManagedFolderInformation |
100
|
|
|
|
|
|
|
folder:ParentFolderId |
101
|
|
|
|
|
|
|
/, |
102
|
|
|
|
|
|
|
], |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
IndexedPageFolderView => { |
106
|
|
|
|
|
|
|
MaxEntriesReturned => '100', |
107
|
|
|
|
|
|
|
Offset => $IndexedPagingOffset, |
108
|
|
|
|
|
|
|
BasePoint => 'Beginning', |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
ParentFolderIds => { |
111
|
|
|
|
|
|
|
cho_FolderId => [ |
112
|
|
|
|
|
|
|
{ |
113
|
|
|
|
|
|
|
DistinguishedFolderId => { |
114
|
|
|
|
|
|
|
(exists $opts->{folderId} ? ( |
115
|
|
|
|
|
|
|
Id => $self->FolderId, |
116
|
|
|
|
|
|
|
) : Id => "msgfolderroot",) |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
], |
120
|
|
|
|
|
|
|
}, |
121
|
|
|
|
|
|
|
); |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->_check_for_errors('FindFolder', $find_response); |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
push( @items, $self->_list_folderitems('FindFolder', $find_response)); |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$IndexedPagingOffset = $self->_PagingOffset('FindFolder', $find_response); |
128
|
|
|
|
|
|
|
} while ( $IndexedPagingOffset > 0 ); |
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
return return EWS::Folder::ResultSet->new({items => []}) |
131
|
|
|
|
|
|
|
if scalar @items == 0; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# Now add to that the details for the actual 'Top of Information Store' folder. |
134
|
0
|
|
|
|
|
|
my $get_response = scalar $self->client->GetFolder->( |
135
|
|
|
|
|
|
|
(exists $opts->{impersonate} ? ( |
136
|
|
|
|
|
|
|
Impersonation => { |
137
|
|
|
|
|
|
|
ConnectingSID => { |
138
|
|
|
|
|
|
|
PrimarySmtpAddress => $opts->{impersonate}, |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
}, |
141
|
|
|
|
|
|
|
) : ()), |
142
|
|
|
|
|
|
|
RequestVersion => { |
143
|
|
|
|
|
|
|
Version => $self->client->server_version, |
144
|
|
|
|
|
|
|
}, |
145
|
|
|
|
|
|
|
FolderShape => { |
146
|
|
|
|
|
|
|
BaseShape => 'IdOnly', |
147
|
|
|
|
|
|
|
AdditionalProperties => { |
148
|
|
|
|
|
|
|
cho_Path => [ |
149
|
|
|
|
|
|
|
{ExtendedFieldURI => { |
150
|
|
|
|
|
|
|
PropertyTag => '3592', |
151
|
|
|
|
|
|
|
PropertyType => 'Integer', |
152
|
|
|
|
|
|
|
}}, |
153
|
0
|
0
|
|
|
|
|
map {{ |
|
|
0
|
|
|
|
|
|
154
|
|
|
|
|
|
|
FieldURI => { |
155
|
|
|
|
|
|
|
FieldURI => $_, |
156
|
|
|
|
|
|
|
}, |
157
|
|
|
|
|
|
|
}} qw/ |
158
|
|
|
|
|
|
|
folder:DisplayName |
159
|
|
|
|
|
|
|
folder:FolderClass |
160
|
|
|
|
|
|
|
folder:ChildFolderCount |
161
|
|
|
|
|
|
|
folder:ManagedFolderInformation |
162
|
|
|
|
|
|
|
folder:ParentFolderId |
163
|
|
|
|
|
|
|
/, |
164
|
|
|
|
|
|
|
], |
165
|
|
|
|
|
|
|
}, |
166
|
|
|
|
|
|
|
}, |
167
|
|
|
|
|
|
|
FolderIds => { |
168
|
|
|
|
|
|
|
cho_FolderId => [ |
169
|
|
|
|
|
|
|
{DistinguishedFolderId => { |
170
|
|
|
|
|
|
|
(exists $opts->{folderId} ? ( |
171
|
|
|
|
|
|
|
Id => $self->FolderId, |
172
|
|
|
|
|
|
|
) : Id => "msgfolderroot",) |
173
|
|
|
|
|
|
|
}}, |
174
|
|
|
|
|
|
|
], |
175
|
|
|
|
|
|
|
}, |
176
|
|
|
|
|
|
|
); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
$self->_check_for_errors('GetFolder', $get_response); |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
push( @items, $self->_list_folderitems('GetFolder', $get_response)); |
181
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
return EWS::Folder::ResultSet->new({ |
183
|
|
|
|
|
|
|
items => [ @items ] |
184
|
|
|
|
|
|
|
}); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
1
|
|
|
1
|
|
9
|
no Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
188
|
|
|
|
|
|
|
1; |
189
|
|
|
|
|
|
|
|