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

I am dealing with Outlook 2000 via Win32::OLE module. When I open a new instance of Outlook with following code

$outlook = Win32::OLE->new('Outlook.Application');

It pops up with some dialog boxes. For example "Profile choose", "Mail Server Username & Password", "Personal Folders Password". I would like to provide these values through the program.

One option I came across is providing values to the popup dialog boxes via SendKeys method in Win32-GuiTest module. (Thanks Mr. Muskrat / Foggy Bottoms for your guidance.)

I am wondering whether there is any other proper way to deal with this instead.

Please comeup with your suggessions if you have any... Thanks all monks in advance - SB

edited by ybiC: change conventional <a href=...> URLs to perlmonks style [id://...] to avoid logout of monks with cookies set to some other perlmonks domain

Replies are listed 'Best First'.
Re: Dealing with Popup-windows while connecting Outlook
by NetWallah (Canon) on Aug 15, 2003 at 17:56 UTC
    From MSDN

    If Outlook is not running when you create a NameSpace object variable, the user will be prompted for a profile if the user's mail services startup setting is set to Prompt for a profile to be used. Startup settings are on the Mail Services tab of the Options dialog box (Tools menu). You can use the NameSpace object's Logon method to specify a profile programmatically. Profiles are stored in the Windows registry under the \HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles subkey.

    Here is the (untested) VB equivalent code of what you are trying to do:

    Set myOlApp = CreateObject("Outlook.Application") Set myNameSpace = myOlApp.GetNameSpace("MAPI") myNameSpace.Logon "myProfile", "myPassword", True, True

      This is a really good solution for me, if it is possible to apply in Perl. When I call
      $namespace->login("profile", "password", 0, 1);
      it gives:

      retrying default method at .../site/lib/"in32/OLE/Lite.pm line 156.
      Win32::OLE(0.1403) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "" at <path> Line <#>

      I think this might be since login method is not implimented in OLE module.

      Do you have any alternation to achieve the success here? - SB

        The method name you need is logon , not login.

        Documentation for this method is here

        Change your code as shown below, and retry.

        $namespace->logon("profile", "password", 0, 1);