473,378 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Logon method of the Outlook NameSpace Object

Hi,

Using the PIA "Microsoft Outlook 11 Object Library".
I've noticed that the Logon method of the NameSpace Object is simply ignored.

My Outlook 2003 is full updated.

For example if I write:

Dim oApp As New Outlook.Application
Dim oNs As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNs.Logon("Outlook", "myPassword", false, True)
Dim oFolder As Outlook.MAPIFolder =
oNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFo lderContacts)

Please note that I'm using only one profile: Outlook and the password is:
myPassword
but the Logon method is ignored and a user request for the password is
displayed.

Thank you for your help

Manuel
Oct 26 '06 #1
6 21267
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.olFo lderInbox)
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.

Oct 27 '06 #2
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.olFo lderInbox)
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.

Oct 27 '06 #3
Hi Manuel,

The logon method is mainly working with Exchange environment as a MAPI
session.
Also if we check the document VBA Outlook help file
C:\Program Files\Microsoft Office\OFFICE11\1033\VBAOL11.CHM
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.
NOTE the last sentence, the logon password is different from the PST
passwords(i.e. the password you set for the Personal Folder which is linked
to a local pst file)
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.

Oct 27 '06 #4
Hi Peter,

It's clear.
Thank you very much.

Regards

Manuel

""Peter Huang" [MSFT]" wrote:
Hi Manuel,

The logon method is mainly working with Exchange environment as a MAPI
session.
Also if we check the document VBA Outlook help file
C:\Program Files\Microsoft Office\OFFICE11\1033\VBAOL11.CHM
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.

NOTE the last sentence, the logon password is different from the PST
passwords(i.e. the password you set for the Personal Folder which is linked
to a local pst file)
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.

Oct 27 '06 #5
Hi Manuel,

You are welcomed!
If you have any other question, please feel free to post in the MSDN
newsgroups.
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.

Oct 31 '06 #6
I am having similar issues to those described in this thread and I'd
like to follow-up here. The problem is that at development time I
don't know how the end-user has Outlook configured. Here are the
scenarios I need to detect and accommodate:
- User working from local PST, Outlook is not yet started.
- User working from local PST, Outlook is open.
- User working from Exchange Server, Outlook is not yet started.
- User working from Exchange Server, Outlook is open.

If the user is working with a PST then user/psw are null/nothing, and
I may not even need to execute the Login - but how do I know this? At
the moment I'm using a .config file, and if it contains a
user/password then I use them to attempt a login. If not, I execute
Login with null values. I'm still not sure under what condition I'd
simply not attempt a .Login.

And I'm not sure how I would detect if Outlook is already open, so
that I would know whether to set the NewSession value to true or
false. If I make the wrong choice it puts Outlook into a weird state,
and the next time they open the application a dialog warns them that
data may be corrupted and they may need to re-install Outlook. That's
scary and not true. Closing and restarting Outlook clears this
ScareUserFlag.

Thanks!
Tony
MSDN Developer / Microsoft Partner
v-******@online.microsoft.com ("Peter Huang" [MSFT]) wrote:
>Hi Manuel,

You are welcomed!
If you have any other question, please feel free to post in the MSDN
newsgroups.
Best regards,

Peter Huang

Microsoft Online Community Support
Nov 11 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manfred | last post by:
I want to access via CDO outlook. Therfore i have to logon. In VB.NEt I make it like: Dim objSession As MAPI.Session If objSession Is Nothing Then objSession = CreateObject("MAPI.Session")...
7
by: Anushya | last post by:
Hi How to get the id of a name in contact items in outlook. How to do it thru redemption in .net?? i tried the code below. but it shows the error. pls have a look at the code ...
2
by: W Akthar | last post by:
Hi All, I have written a windows service which runs a small windows application. This windows application queries a sql server database and depending on these results, sets appointments in...
9
by: George McCullen | last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in...
4
by: digger27 | last post by:
I am trying to progamatically create tasks in Outlook using VB.Net. I am using the following code: **** Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
4
by: Pieter | last post by:
Hi, On the pc of one of my clients (W2000, Office 2003) I'm getting sometimes an exception when moving (Move) a MailItem to an Outlook-Folder: The RPC server is not available. (Exception from...
5
by: John A. Bailo | last post by:
I have a program that I'm converting from Outlook 2000 to Outlook 2003. It basically opens Outlook and iterates through a series of items in a public folder. I was able to run this as a...
3
by: Volkan Senguel | last post by:
Hi Is there a easy way to get the contacts (names and phonenumbers) from outlook without the message that someone is accessing outlook and how long the access can take? i have not found any...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.