Accessing Logon Method in CDO

  • Thread starter Thread starter Manfred
  • Start date Start date
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 ?
 
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.
 
Back
Top