http://www.perlmonks.org?node_id=184158

krujos has asked for the wisdom of the Perl Monks concerning the following question:

I am running into an interesting problem. I have to verify that backups and restores worked for my MS exchange server. The "by hand" way to do this is to make sure the directory / file system within exchange is restored and intact. I am trying to automate this process using perl. So here is the crux of my question. Has any one seen modules for exchange? Is it just another part of DBI? I know it’s not exactly a database, but still. Has anyone had experience using perl with exchange? I would like to be able eventually, to create mail boxes, check that msg's and boxes are there etc. I have searched CPAN, and Perlmonks, but still seem to be finding nothing.
Thanks in advance for the help.
Josh

Replies are listed 'Best First'.
Re: MS Exchange and Perl
by Jenda (Abbot) on Jul 22, 2002 at 20:42 UTC

    I doubt there is any special module for MS Exchange. But did you try Win32::OLE? If MS Exchange may be controled from VB(Script) using "automation" you may do the same from Perl. Just the syntax will be a little different.

    I can't give you any examples, but you should be able to find examples of controling MSWord and MSExcel via Win32::OLE and that should give you a hint how this looks.

    Sorry I can't be more specific, Jenda

Re: MS Exchange and Perl
by Necos (Friar) on Jul 23, 2002 at 11:17 UTC
    Our old friend Dave Roth mentions something about manipulating various OLE-capable files in TSE (check: http://www.roth.net). I believe that the chapter on Win32::OLE does mention Outlook/Exchange files. Unfortunately, I don't have my book with me to confirm this, but I believe that Roth has the table of contents on the webpage, so you can check.

    Theodore Charles III
    Network Administrator
    Los Angeles Senior High
    4650 W. Olympic Blvd.
    Los Angeles, CA 90019
    323-937-3210 ext. 224
    email->secon_kun@hotmail.com
    perl -e "map{print++$_}split//,Mdbnr;"
Re: MS Exchange and Perl
by Theseus (Pilgrim) on Jul 22, 2002 at 19:38 UTC
    I'm in the same boat, learning how to really manipulate Exchange with perl would be a huge boon to me, but I haven't seen any mention of it being done before, and haven't had the time to do much research. If you do have luck in finding anything, make sure to post it here for future monk usage(probably me)!
Re: MS Exchange and Perl
by cacharbe (Curate) on Jul 23, 2002 at 20:09 UTC
    If you are working on a Win32 box, you can always access data through an outlook object by opening a MAPI name space. If Outlook is pointing at the proper Excahnge Server, then you will be able to traverse all of the folders correctly.

    I've made a couple posts about it here on PerlMonks before, including:

    As far as creating mailboxes and the like are concerned, you'll probably have to examine the IDISPATCH (Win32::OLE) interface of the Exchange objects themselves. I don't have a machine with Exchange loaded on it (except for our exchange server, of course), so I can't really give any insight to the object model right now, but I'll see what I can scrounge up.

    If you happen to have an exchange server with AS perl loaded on it, you can always use Jan's object browser.

    C-.

    ---
    Flex the Geek