Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

another perl and outlook question

by primus (Scribe)
on Jun 10, 2003 at 14:25 UTC ( [id://264683]=perlquestion: print w/replies, xml ) Need Help??

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

hail monks,

i am writing a perl script to display the items in an outlook calendar. i have outlook 2000 installed locally on my computer, i am NOT using exchange or anything. here is the code i have so far:
#!/usr/bin/perl use warnings; use strict; use Win32::OLE; # ---------------------------------------- print "Content-type:text/html\n\n"; my $ol = Win32::OLE->new('Outlook.Application') or die "error\n"; my $olns = $ol->GetNameSpace("MAPI") or die "can't open MAPI namespace +\n"; my $folder = $olns->GetDefaultFolder(9); my $items = $folder->{Items}; for my $index (1 .. $items->{Count}) { print $items->Item($index)->{Subject} . "\n"; print $items->Item($index)->{Body} . "\n"; print $items->Item($index)->{Start} . "\n"; print $items->Item($index)->{End} . "\n"; }

it works fine running through CMD, but when i try to run it through IIS, it just hangs and does nothing. i also get an error in event viewer stating: "the server { ... } did not registe with DCOM within the required timeout."

i read on google groups that i should use CDO or extended mapi... not quite sure how to go about this, i dont know if there is an easier way with the code i have?

thanks monks!

Replies are listed 'Best First'.
Re: another perl and outlook question
by NetWallah (Canon) on Jun 10, 2003 at 18:39 UTC
    The issue here is how IIS operates on the web page.

    The CONTEXT of the web page is usually ANONYMOUS, , wihch on IIS maps to a user-id like IUSER_<computername>.

    Hence, when someone opens the page (unless the IIS security is configured otherwise), the page runs under the IUSER user name, which may not (usually does not) have a MAIL profile associated with it.

    The trick is to make the page run under the context you want - this is an IIS property for the directory or the specific web page. Do NOT allow anonymous. You can use "Integrated" authentication if this is an intranet app.

    The other key issue is that the person whose context the page runs under - must have an Outlook profile defined ON THE IIS SERVER.. All this means is that you must have outlook run at least once as that user, on that server.

      okay, so if i use integrated authentication, then DOMAIN\jsmith would have to have a profile for outlook, and also DOMAIN\mdoe would need a seperate profile? is there a way some everyone uses the same calendar?
        If you're using Exchange Server, yes. I suppose there may be a way to have a shared calendar without using Exchange, but I'm not sure how to do it.

        mike
      as a note to this. integreted authentication is does work to read the calendar over the web, but is there a way to pass a different set of credentions directly to outlook when it tries to connect?

      because, only the user DOMAIN\jsmith can access it over the web... because his credentials are DOMAIN\jsmith, and say that the calendar was created under him... so he has a PST file in Docs and Settings\jsmith\Local Settings\Application Data\Outlook and since he has that file he can access it, but i tried to make the pst file in the all users folder, or default user's folder on the server, would something like this work? or does anyone know how?

      thanks alot monks
Re: another perl and outlook question
by mjeaton (Hermit) on Jun 10, 2003 at 14:43 UTC
    A few years ago I wrote an app that displayed Outlook contacts within a VB app. I used CDO, but if I remember correctly, the trick is to make sure a MAPI user account is created for the IIS user.

    mike
      that sounds like it may work, but i am not sure what you mean by, "make sure a MAPI user account is created for the IIS user." is that for exchange? i am just using outlook? not exchange... i am kinda at a loss, thanks for the reply though.
        What I had to do on the server is:

        1) Install Outlook
        2) In the Control Panel, open the Mail applet and Add a user.

        I'm trying to find my original code (it's on a CD somewhere). When I do, I'll let you know specifically what I had to do. I remember it was a real pain, but once it was working, the client *loved* it. :-)

        mike
        when i add it to the server, do i use the same name as the guest account (IUSR_COMPUTERNAME) ? and i am unsure what to add for the smpt or pop3 servers? localhost? ...thanks for the info.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found