Accessing Logon Method in CDO

M

Manfred

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", _
ShowDialog:=True)
End If

The point are parameters in method Logon. In VB i set only
2 parameters.
But in C# the compiler throws an error.
code in C#:

MAPI.Session session = new MAPI.Session();
session.Logon("Outlook");

Logon Method expects 7 parameters.
How can i invoke Logon-Method with 1 parameter ?
Does anyone know a solution ?
 
N

Nicholas Paldino [.NET/C# MVP]

Manfred,

For the other parameters, do this:

// Store the missing value.
object pobjMissing = System.Reflection.Missing.Value;

// Pass the missing value for everything else.
objSession.Logon("Outlook", pobjMissing, pobjMissing, pobjMissing, ...

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top