473,549 Members | 2,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Applica tion
Dim oNs As Outlook.NameSpa ce = oApp.GetNamespa ce("mapi")
oNs.Logon("Outl ook", "myPassword ", false, True)
Dim oFolder As Outlook.MAPIFol der =
oNs.GetDefaultF older(Outlook.O lDefaultFolders .olFolderContac ts)

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 21292
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.Offic e.Interop.Outlo ok
Module Module1
Sub Main()
Dim oApp As New Outlook.Applica tion
Dim oNs As Outlook.NameSpa ce = oApp.GetNamespa ce("mapi")
'oNs.Logon("Def ault Outlook", "myPassword ", False, True)
Dim oFolder As Outlook.MAPIFol der =
oNs.GetDefaultF older(Outlook.O lDefaultFolders .olFolderInbox)
For i As Integer = 1 To 5
Console.WriteLi ne(oFolder.Item s(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 ToExampleSpecif icsLogs the user on to MAPI, obtaining a
MAPI session.
expression.Logo n(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.Offic e.Interop.Outlo ok
Module Module1
Sub Main()
Dim oApp As New Outlook.Applica tion
Dim oNs As Outlook.NameSpa ce = oApp.GetNamespa ce("mapi")
'oNs.Logon("Def ault Outlook", "myPassword ", False, True)
Dim oFolder As Outlook.MAPIFol der =
oNs.GetDefaultF older(Outlook.O lDefaultFolders .olFolderInbox)
For i As Integer = 1 To 5
Console.WriteLi ne(oFolder.Item s(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 ToExampleSpecif icsLogs the user on to MAPI, obtaining a
MAPI session.
expression.Logo n(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.C HM
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.C HM
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.m icrosoft.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
5193
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") End If If Not objSession Is Nothing Then objSession.Logon(profileName:="Outlook", _
7
3283
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 Microsoft.Office.Interop.Outlook.NameSpace oNs; oNs = Connect.oApplication.GetNamespace("MAPI"); //it shows an error here - invalid cast exception
2
3534
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 outlook. When I run the windows application outside the service it works fine as designed, but when it is launched from a windows service I get an...
9
3067
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 oItems" loop. After about 250 contacts, the program gives an InvalidCastException Error on the for each loop. I notice that Outlook's memory keeps...
4
4168
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 MyBase.Load Dim olApp As Outlook.Application Dim olNS As Outlook.NameSpace Dim olFolder As Outlook.MAPIFolder Dim olTaskItem As Outlook.TaskItem...
3
8268
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 the utility to work for all 3 versions. A previous post suggested creating objects to detect the version of outlook, which I tried with success. ...
4
6673
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 HRESULT: 0x800706BA). The client has all the updates/service packs/ etc isntalled... Does anybody has any idea why this happens? Any help our hints...
5
3030
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 scheduled task overnight. But now, it seems to want to have me be logged in already or it will not log into Outlook.
3
3382
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 working solution for that :( thanks for any help Volkan
0
7526
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7723
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7965
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7483
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5092
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
771
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.