Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Perl with Outlook Calendar

by Kevman (Pilgrim)
on Sep 06, 2001 at 14:19 UTC ( [id://110533]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All, As a side issue to my usual work, I was looking for
a function to post / retrieve information from an outlook calendar file

Despite some trawling with google, no joy yet.
Has anyone else out there tried this?

Kevman

PS. Not too complicated please!!!

Replies are listed 'Best First'.
Re: Perl with Outlook Calendar
by Corion (Patriarch) on Sep 06, 2001 at 15:19 UTC

    You will have to use Win32::OLE and the Outlook Object Model, which should be documented in the MSDN. I've done this already, and if you only want to retrieve data from the Outlook Object Model, it's relatively simple as long as you stay with what Outlook delivers.

    If you dare to venture into the realms of shared calendars and Exchange servers, you're in for a different bag.

    Here is one node by me, discussing the basics of using Outlook via Win32::OLE, and here is a fully functional (Win32) snippet, which extracts all phone numbers from Contact Items. You would want Calendar Items instead, but the modifications are trivial as soon as you found the map of the Outlook Object Model on the MSDN.

      Speaking of Exchange, I might find myself in a situation where I have to write a script to say, make batch updates to all users and/or contacts in an Exchange db...

      What am I in for..? Can this be done? Otherwise it's importing and exporting CSV's...

        Writing to Exchange is easy as long as you can use the Outlook Object Model. When I used the Outlook Object Model to do live caller-id lookup against a contacts database of about 400 Contact Items on an Exchange (4) server, I found the Outlook Object Model to be abysmally slow for searching through all these contacts. I had (not with Perl, mind you) to turn to true MAPI, which is more or less like SQL without the ASCII command syntax, and you have to manage the result tables yourself. MAPI has the great performance you'd expect from a relational database, but interfacing MAPI to Perl is really hard.

        To set the value of a property via the OOM, just assign to that property. As (I guess) this will be a one off job, time is not that important, and you can try to use the Outlook Object Model. Stuff you can't do with the OOM is for example change or preserve sociations between Outlook Items, as there is not much way to get at the MAPI unique item IDs.

Re: Perl with Outlook Calendar
by idnopheq (Chaplain) on Sep 06, 2001 at 14:44 UTC
    If you have ActiveState's perl for Win32, there's an OLE Browser included in the on-line documentation. Use that info w/ Win32::OLE to get and put data into your Outlook calendar.

    I had something like this, once. But unfortunately my current employer feels the need to force Notes on us.

    HTH
    --
    idnopheq
    Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

      I had to do something similar using Adobe Acrobat once. Win32::OLE plus the Acrobat Object Model (and Perl, of course) saved the day.

      dmm

      Just call me the Anti-Gates ...
      
Re: Perl with Outlook Calendar
by petdance (Parson) on Sep 06, 2001 at 16:51 UTC
    I'll just echo what everyone else said about using the Outlook object model. I believe that in the back of Outlook 2000 In A Nutshell there's a high-level chart of the object model. (Remembering back to a year ago when I had a similar project...)

    xoxo,
    Andy
    --
    <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

Re: Perl with Outlook Calendar
by elwarren (Priest) on Sep 07, 2001 at 03:07 UTC
    There is also this script in the CUFP section that will stuff a text file into an Outlook note. Was just looking for it myself to move some data into my new PocketPC.

    HTH
Re: Perl with Outlook Calendar
by thraxil (Prior) on Sep 07, 2001 at 07:03 UTC
Re: Perl with Outlook Calendar
by Anonymous Monk on Jan 12, 2002 at 08:00 UTC
    I read your note while looking for help with reading from the Outlook calendar. I have done some programming based on what I could glean frome sites and from the MSDN <shudder> and have posted my code to the Monks. This program should be able to help you out with reading of the data.

    A helpful tool was once I had gotten the items, I did a foreach loop of them like this:

    my $calitems = $namespace->GetDefaultFolder(olFolderCalendar)->{Items} +; my $it = $calitems->GetFirst; #get the first Appointment item foreach my $key (keys %$it) { print "$key = $it->{$key}\n"; }

    For things that get printed out as Win32::OLE::Variant take a look at Win32::OLE::Variant documentation.

    And once you get used to how they do things, the MSDN is a good resource.

    -- David Weand (dweand@vt.edu)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://110533]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-19 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found