RE: Logon method of the Outlook NameSpace Object

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Peter,

Thank you for your helpful response.

The Outlook is not connected to Exchange Server (for now)
I'm using the default Outlook profile created during setup and I have only
set a password to the personal folders.
If I start Outlook directly the password dialog will pop up.

Best regards,
Manuel


""Peter Huang" [MSFT]" wrote:

Hi Manuel,

Can you describe how did you configurate your outlook profile?
Did the outlook connect to the Exchange Server?
If you start Outlook directly, will the password dialog pop up?

Based on my test, my Outlook is opened to connect to the Exchange server,
but I did not get prompt that I need input password.

Also the code below will work without call the Logon method.
Imports Outlook = Microsoft.Office.Interop.Outlook
Module Module1
Sub Main()
Dim oApp As New Outlook.Application
Dim oNs As Outlook.NameSpace = oApp.GetNamespace("mapi")
'oNs.Logon("Default Outlook", "myPassword", False, True)
Dim oFolder As Outlook.MAPIFolder =
oNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
For i As Integer = 1 To 5
Console.WriteLine(oFolder.Items(i).Subject)
Next
oApp.Quit()
End Sub
End Module

Also from the VBA help file, we did not recommend you use Password option.

Show All

Logon Method
See AlsoApplies ToExampleSpecificsLogs the user on to MAPI, obtaining a
MAPI session.


expression.Logon(Profile, Password, ShowDialog, NewSession)
expression An expression that returns a NameSpace object.

Profile Optional Variant. The MAPI profile name, as a String, to use for
the session.

Password Optional Variant. The password (if any), as a String,
associated with the profile. This parameter exists only for backwards
compatibility and for security reasons, it is not recommended for use.
Microsoft Oultook will prompt the user to specify a password in most system
configurations. This is your logon password and should not be confused with
PST passwords.

ShowDialog Optional Variant. True to display the MAPI logon dialog box
to allow the user to select a MAPI profile.


NewSession Optional Variant. True to create a new Outlook session. Since
multiple sessions cannot be created in Outlook, this parameter should be
specified as True only if a session does not already exist.



If you have any concern, please feel free to let me know.


Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
    ... Should I upload code for the other pieces of what I'm doing to impersonate the domain user, create the mapi profile and then configure it? ... OutlookSpy - Outlook, CDO ... running under the same domain account. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
    ... I do note delete the MAPI profile after calling MAPILogonEx. ... I try to keep the profile around so it doesn't have to be recreated every time a message is read. ... and has Outlook 2003. ... running under the same domain account. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: MAPI_E_LOGON_FAILED when running two MAPI clients as different users
    ... Outlook 2002 SP3, though. ... I only delete the profile if there is some error establishing connections. ... Are there any other DLLs that I should be looking at for MAPI version info? ... running under the same domain account. ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Mapisvc.inf Question
    ... Outlook was never installed. ... I am pretty sure that this is the "one and only" wizard common ... I do -NOT- have a profile, configured, as I said earlier the MAPI add ...
    (microsoft.public.win32.programmer.messaging)
  • Re: acessing addressbooks from two different profiles
    ... > * Searches container in the Outlook Address Book hierarhy table by it's AB ... > * Searches Outlook Address Book container in the MAPI Address Book ... >> PAB. ... >> profile, ...
    (microsoft.public.win32.programmer.messaging)