View Single Post
  #8  
Old July 18th 08, 06:28 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default C# Error when calling MAPI.Session.Logon()

That will break if the user has more than one profile and a non-default
profiel is used.
Setting the MAPIOBJECT property (Outlook 2002 and up) will work much better.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Johan Machielse" wrote in
message ...
Hi Ken,

I figured out what how the Logon method has to be called:

mapiSession.Logon("Default Outlook Profile",
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
It works!

Regards,

Johan Machielse
Avanade

"Ken Slovak - [MVP - Outlook]" wrote:

First of all CDO 1.21 is not supported for use with any managed code, so
if
it doesn't work then you won't get any help.

That said, you could try using null strings instead of null for the first
2
arguments to Logon().

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Johan Machielse" Johan wrote in
message ...
Dear reader,

See next piece of code (written in C#):

MAPI.Session mapiSession = new MAPI.Session();
mapiSession.Logon(null, null, false, false, 0, false, "");

The call mapiSession.Logon() throws the following exception:
[Collaboration Data Objects - [E_INVALIDARG(80070057)]

What can I do to solve this problem; which arguments do I have to pass?

Thank you in advance,

Johan Machielse
Avanade






Ads