![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi,
I am using MAPI in a C#-Program via a wrapper-class which simple DLLImports the functions from mapi32.dll. I am calling MAPILogon like this: MAPILogon(hwnd, null, null, 0, 0, ref session); hwnd is IntPtr.Zero (NULL in C++). When I call this code somewhere in FormShow or similar (in the GUI-Thread) anything works fine, I get logged in without being prompted anything. Now, I have a Socket which asynchroniously listens on a port. When some data is being received I am in a new thread. In this thread the same code from above failes with the error-code 3 (MAPI_E_LOGIN_FAILURE?) Why? Please help, this is kinda urgent... Thanks a lot in advance |
Ads |
#2
|
|||
|
|||
![]()
=?Utf-8?B?RGFuaWVsSA==?= wrote in
: I am using MAPI in a C#-Program via a wrapper-class which simple DLLImports the functions from mapi32.dll. You do know that this is officially unsupported, right? http://support.microsoft.com/kb/813349 I am calling MAPILogon like this: MAPILogon(hwnd, null, null, 0, 0, ref session); hwnd is IntPtr.Zero (NULL in C++). When I call this code somewhere in FormShow or similar (in the GUI-Thread) anything works fine, I get logged in without being prompted anything. Now, I have a Socket which asynchroniously listens on a port. When some data is being received I am in a new thread. In this thread the same code from above failes with the error-code 3 (MAPI_E_LOGIN_FAILURE?) Why? Please help, this is kinda urgent... I'd guess that the code isn't running as a user that has permission to log into the profile that your code is trying to use. Are you trying to pass the session between threads? When your code is running in the main thread, it's not logging in as such, it's just hooking onto the existing Outlook session -- in the other thread, it has to create a session to log into, so it may well be trying to pop up a dialog behind the scenes and failing. Try passing in the name of the profile you're using, that might help. -- dan -- dan |
#3
|
|||
|
|||
![]() "Dan Mitchell" schrieb: =?Utf-8?B?RGFuaWVsSA==?= wrote in : I am using MAPI in a C#-Program via a wrapper-class which simple DLLImports the functions from mapi32.dll. You do know that this is officially unsupported, right? http://support.microsoft.com/kb/813349 No, I didn't know, that it is not supported... How can I then send an eMail via Outlook in .NET? I am calling MAPILogon like this: MAPILogon(hwnd, null, null, 0, 0, ref session); hwnd is IntPtr.Zero (NULL in C++). When I call this code somewhere in FormShow or similar (in the GUI-Thread) anything works fine, I get logged in without being prompted anything. Now, I have a Socket which asynchroniously listens on a port. When some data is being received I am in a new thread. In this thread the same code from above failes with the error-code 3 (MAPI_E_LOGIN_FAILURE?) Why? Please help, this is kinda urgent... I'd guess that the code isn't running as a user that has permission to log into the profile that your code is trying to use. Are you trying to pass the session between threads? When your code is running in the main thread, it's not logging in as such, it's just hooking onto the existing Outlook session -- in the other thread, it has to create a session to log into, so it may well be trying to pop up a dialog behind the scenes and failing. Try passing in the name of the profile you're using, that might help. I tried to pass the profile-name - no changes. The user the program is running the program is local admin, so this shouldn't be a problem... I don't see the difference between the main-thread and any other thread. Why is one thread simply hooking into the existing session and one thread not? Thanks for your answer |
#4
|
|||
|
|||
![]()
Jumping in here for Dan. Neither Extended MAPI nor CDO 1.21 is supported for
..NET code, it might work sometimes but you can't rely on it. You must use the Outlook object model or a wrapper for Extended MAPI that works across the Interop such as Redemption (www.dimastr.com/redemption). -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "DanielH" wrote in message ... "Dan Mitchell" schrieb: =?Utf-8?B?RGFuaWVsSA==?= wrote in : I am using MAPI in a C#-Program via a wrapper-class which simple DLLImports the functions from mapi32.dll. You do know that this is officially unsupported, right? http://support.microsoft.com/kb/813349 No, I didn't know, that it is not supported... How can I then send an via Outlook in .NET? I am calling MAPILogon like this: MAPILogon(hwnd, null, null, 0, 0, ref session); hwnd is IntPtr.Zero (NULL in C++). When I call this code somewhere in FormShow or similar (in the GUI-Thread) anything works fine, I get logged in without being prompted anything. Now, I have a Socket which asynchroniously listens on a port. When some data is being received I am in a new thread. In this thread the same code from above failes with the error-code 3 (MAPI_E_LOGIN_FAILURE?) Why? Please help, this is kinda urgent... I'd guess that the code isn't running as a user that has permission to log into the profile that your code is trying to use. Are you trying to pass the session between threads? When your code is running in the main thread, it's not logging in as such, it's just hooking onto the existing Outlook session -- in the other thread, it has to create a session to log into, so it may well be trying to pop up a dialog behind the scenes and failing. Try passing in the name of the profile you're using, that might help. I tried to pass the profile-name - no changes. The user the program is running the program is local admin, so this shouldn't be a problem... I don't see the difference between the main-thread and any other thread. Why is one thread simply hooking into the existing session and one thread not? Thanks for your answer |
#5
|
|||
|
|||
![]()
"Ken Slovak - [MVP - Outlook]" wrote in
: Jumping in here for Dan. Neither Extended MAPI nor CDO 1.21 is supported for .NET code, it might work sometimes but you can't rely on it. To be precise, quoting from a MS support guy in another newsgroup: "It's the sort of thing that'll mostly work. It'll work while you're writing it. Then it'll work while you're testing it. It'll work while your customer is evaluating it. Then as soon as the customer deploys it - BAM! That's when it'll decide to start having problems. And Microsoft ain't gonna help you with it, since we told you not to do it in the first place. ![]() You must use the Outlook object model or a wrapper for Extended MAPI that works across the Interop such as Redemption (www.dimastr.com/redemption). There's also mapi33.net, which a lot of people seem to have had success with, though it's still not supported by MS. -- dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Grouping problem (thread hierarchy screwed up by OE6) | Vanguard | Outlook Express | 5 | March 11th 06 09:05 AM |
Conversation Thread | Raffi Bearmant | Outlook - General Queries | 0 | January 13th 06 06:45 AM |
How can I delete a thread in a newsgroup? | Mike G | Outlook Express | 4 | January 13th 06 02:21 AM |
Solution to this thread found | skinnyladuk | Outlook - General Queries | 0 | January 12th 06 12:52 AM |
Reply/Forward Keeps Running Thread in one Message Instead of Separ | Delnang | Outlook - Using Forms | 0 | January 9th 06 04:27 PM |