| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
303285
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
154
|
|
|
2
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
114
|
|
|
3
|
|
|
|
|
|
|
package Office365::EWS::Client; |
|
4
|
2
|
|
|
2
|
|
2577
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Office365::EWS::Client::GAL; |
|
6
|
|
|
|
|
|
|
extends 'EWS::Client'; |
|
7
|
|
|
|
|
|
|
with qw/ |
|
8
|
|
|
|
|
|
|
Office365::EWS::Client::Role::SOAP |
|
9
|
|
|
|
|
|
|
Office365::EWS::Client::Role::FindPeople |
|
10
|
|
|
|
|
|
|
Office365::EWS::GAL::Role::Reader |
|
11
|
|
|
|
|
|
|
/; |
|
12
|
|
|
|
|
|
|
has gal => ( |
|
13
|
|
|
|
|
|
|
is => 'ro', |
|
14
|
|
|
|
|
|
|
isa => 'Office365::EWS::Client::GAL', |
|
15
|
|
|
|
|
|
|
lazy_build => 1, |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
sub _build_gal { |
|
18
|
|
|
|
|
|
|
my $self = shift; |
|
19
|
|
|
|
|
|
|
return Office365::EWS::Client::GAL->new({ client => $self }); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
no Moose; |
|
22
|
|
|
|
|
|
|
1; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ABSTRACT: Office 365 Exchange Web Services client |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Office365::EWS::Client - Office 365 Exchange Web Services client |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
version 1.142410 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Set up your Office 365 Exchange Web Services client. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use Office365::EWS::Client; |
|
45
|
|
|
|
|
|
|
use DateTime; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $ews = Office365::EWS::Client->new({ |
|
48
|
|
|
|
|
|
|
server => 'pod12345.outlook.com', |
|
49
|
|
|
|
|
|
|
username => 'oliver@some.org', |
|
50
|
|
|
|
|
|
|
password => 's3krit', # or set in $ENV{EWS_PASS} |
|
51
|
|
|
|
|
|
|
}); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Then perform operations on the Exchange server: |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $entries = $ews->calendar->retrieve({ |
|
56
|
|
|
|
|
|
|
start => DateTime->now(), |
|
57
|
|
|
|
|
|
|
end => DateTime->now->add( months => 1 ), |
|
58
|
|
|
|
|
|
|
}); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print "I retrieved ". $entries->count ." items\n"; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
while ($entries->has_next) { |
|
63
|
|
|
|
|
|
|
print $entries->next->Subject, "\n"; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $contacts = $ews->contacts->retrieve; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $gal = $ews->gal->retrieve( { querystring => "John Doe" } ); |
|
69
|
|
|
|
|
|
|
if ( $gal->count() > 0 ) { |
|
70
|
|
|
|
|
|
|
while ($gal->has_next) { |
|
71
|
|
|
|
|
|
|
my $entry = $gal->next; |
|
72
|
|
|
|
|
|
|
print $entry->DisplayName, "\n"; |
|
73
|
|
|
|
|
|
|
print $entry->EmailAddress->{EmailAddress}, "\n\n"; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This module acts as a client to the Office 365 Exchange Web Services API. From |
|
80
|
|
|
|
|
|
|
here you can access calendar and contact entries using the capabilities of |
|
81
|
|
|
|
|
|
|
L<EWS::Client>. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Jesse Thompson <zjt@cpan.org> |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Jesse Thompson. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |