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

I have been successfully running various code using Win32::OLE to read inboxes and public folders from my workstation. Example:
use Win32::OLE; use Win32::OLE::Variant; #Needed for ReceivedTime constant. $Outlook=Win32::OLE->new('Outlook.Application'); $namespace = $Outlook->GetNameSpace("MAPI"); $pf1 = $namespace->Folders("Public Folders");
After my workstation was pushed Office SP3 the mail jobs started generating the following message:

Microsoft Outlook: A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? It gives you the option to click "Yes", but if you're reading a mailbox with hundreds of messages then you will have to click the message each time. The message also gives the option to "Allow access for" 1 to 10 minutes. This works fine, but I need to "Allow" indefinitely. I know Microsoft did this, because of all the viruses they were getting hit with, but this is unexceptable for automated code.

Does anyone know of a way to disable this (other than uninstalling) or a switch to add to the code. Any help would be much appreciated, thanks.

Mitch

Replies are listed 'Best First'.
Re: MS Outlook Win32::OLE Security Problem After Office SP3
by tachyon (Chancellor) on Feb 02, 2004 at 18:30 UTC

    Microsoft completely bulldozed the MAPI interface some couple of years ago now (been a while since you added any service packs ;-). This was their (ill thought out) response to all the email worms that were/still are causing havoc. It caused every untrusted (ie non M$) app that used MAPI to explode and no fix was available at the time.

    If you are accessing Exchange mailboxes then there is a security (un)patch that undoes this prompting by allowing you to make your script TRUSTED CODE. If you are accessing PSTs I don't think there is any fix (I could not find one ~8 months ago) but that may have changed.

    Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnout2k2/html/odc_olsecurityovw.asp and do a search for 'MAPI outlook trusted code' or similar on google.

    cheers

    tachyon

      Microsoft completely bulldozed the MAPI interface some couple of years ago now

      Of course, it would be too much trouble to just do what every other mailreader in the universe does and just display the message (rather than attempt to execute it). No, that would be too obvious and straightforward.


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
Re: MS Outlook Win32::OLE Security Problem After Office SP3
by silent11 (Vicar) on Feb 03, 2004 at 14:04 UTC
    This thread may be of some help. I ran into the same problem some time ago -- I've since moved away from Outlook.
    Good luck.


    -silent11