At first, I'm not sure if you can access messages on Exchange with LDAP because I've never tried. I always did so via CDO (=Win32::OLE). All I've already done with Exchange and LDAP is creating distribution lists.

I prefer using the module-group Net::LDAP (called perl-ldap on CPAN or Activestate).

You can connect to Exchange like to any other LDAP-Server about in the following way:

use Net::LDAP; use Net::LDAP::Util qw(ldap_error_text ldap_error_name); # adapt the following variables to your exchange-Server my $server = "192.168.0.1"; # or hostname my $port = 389; my $user = "cn=username,cn=Recipients,ou=Location,o=Company"; my $password = "topSecret"; my $version = 3; # connect to server my $c = Net::LDAP->new($server, port=>$port); die "Error: couldn't connect: $@\n" unless ($c){ # try to bind as user my $mesg = $c->bind( $user, password => $password, version => $version); if ($mesg->code()){ # on error # get errormessages my $errorCode = $mesg->code; my $errorText = ldap_error_text($mesg->code); my $errorMsg = ldap_error_name($mesg->code); $c->Disconnect(); die <<EOD; Error in bind: Code: $errorCode Message: $errorMsg Text: $errorText EOD ;

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"


In reply to Re: Accessing MailBox's from Exchange Server by LDAP by strat
in thread Accessing MailBox's from Exchange Server by LDAP by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.