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

Just curious has anyone ever written a script to go through an outlook folder and then take the emails and put them in an excel spreadsheet by date,time,subject and body. i need to do this and I am not sure how to accomplish it thanks for any advice Bob

Replies are listed 'Best First'.
Re: digging through outlook??
by cacharbe (Curate) on Mar 11, 2002 at 20:15 UTC
    Not specifically. A large number of different code examples exist here on this site, and I would hate to do ALL of your work for you, but I'll try and give you a couple hints:
    use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Outlook'; $|++; $Win32::OLE::Warn = 3; # Fail on errors my $OL = Win32::OLE->GetActiveObject('Outlook.Application') || Win32::OLE->new('Outlook.Application', 'Quit'); my $NameSpace = $OL->GetNameSpace("MAPI"); my $Folder = $NameSpace->GetDefaultFolder(olFolderInbox); foreach my $msg (in $Folder->{Items}){ ##Do something with them. }
    and for a wonderful tutorial on using excel (in the works), feel free to give my scratch pad a once over (or two or three times even).

    The OLE Object Viewer that ships with AS will also be VERY helpful to you. I found the file : c:\perl\html\site\win32\ole\browser

    C-.

      thank you ,thank you , thank you !!!!!!!
Re: digging through outlook??
by patgas (Friar) on Mar 11, 2002 at 20:09 UTC

    Start off by looking at Win32::OLE. I was able to write plenty of stuff that dealt with Outlook and/or Excel just using that module and looking at the documentation for those programs.

    So, to answer your question, yes. :)

    "We're experiencing some Godzilla-related turbulence..."

Re: digging through outlook??
by steves (Curate) on Mar 11, 2002 at 22:43 UTC

    Depending on how your mail is set up, you may also want to take a look at either Mail::IMAPClient or Mail::POP3Client. I've used IMAP several times here at work to pull mail from folders and put it somewhere else.