473,569 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

COM Interop Problem - [CDO - [MAPI_E_UNCONFIG URED(8004011C)]]

Hello,

I'm having problems sending MAPI Mail from an ASP.NET applcation (in VB)
(which worked fine in traditional asp)

When run on our test server, it returns an COMException (0x80010106):
[Collaboration Data Objects - [UNKNOWN_ERROR(8 0010106)]]] exception from
MAPI.
(from the global.asa when trying to create MAPI session I get a .net
exception "Cannot change thread mode after it is set")

According to a post on the microsoft.publi c.in.csharp

"The 80010106 error usually occurs due to incompatible
threading models. ASP.NET uses an MTA thread pool
to service requests for the web service and looks like
the CDO component is apartment threaded (lives in an STA).

In traditional ASPX pages, you'd use the ASPCOMPAT
attribute set to true in the <%@ Page %> directive of an
ASPX page to make a ASP.NET use an STA thread
(instead of an MTA thread) to access the apartment threaded
COM component."

So I set the ASPCOMPAT attribute of the aspx page that calls this method to
"true".

This now appears to create the object correctly.

But returns a new error.
[Collaboration Data Objects - [MAPI_E_UNCONFIG URED(8004011C)]]

I think this may be due to the identity of the STA MAPI Component, being
different from the impersonated ASP.NET user in the Web.config file, but i'm
not sure.
Does anyone know....


a) How I can confirm this is the case?
b) Ensure that the MAPI component is running under the same identity?

I have included below the original legacy code from the traditional asp
application and the new COM Interop code from the ASP.NET version of my
application.

Any suggestions are welcome! particularly code examples ;-)

thank you very much.

Chris V.
'--------------------------------original mail.inc used in asp page
(works).----------------------------------------
Dim oSession
Set oSession = CreateObject("M API.Session")

oSession.Logon "", "", False, True, 0, True,
Application("Ex changeServerLoc ation") & vblf &
Application("Ex changeServerMai lbox")

Dim oOutbox
Set oOutbox = oSession.Outbox

Dim oMessage
Set oMessage = oOutbox.Message s.Add
oMessage.Subjec t = Subject
oMessage.Text = Body

Dim oRecipient

For i = 0 To oVec.Count - 1
Set oRecipient = oMessage.Recipi ents.Add
oRecipient.Name = oVec(i)
oRecipient.Reso lve
Set oRecipient = Nothing

Next

oMessage.Send

oSession.Logoff

Set oMessage = Nothing
Set oOutbox = Nothing
Set oSession = Nothing

'-----------------MAPIMESSAGE.VB (called from test.aspx with aspcompat set
to true.)-----------------------

Imports Microsoft.Offic e.Interop
Imports MAPI

Public Class MAPIMail
Implements IQPWMessageSend er

Private mExchangeServer As String
Private mMailbox As String

Public Sub New(ByVal MAPIExchangeSer ver As String, ByVal MAPIMailbox As
String)
mExchangeServer = MAPIExchangeSer ver
mMailbox = MAPIMailbox
End Sub

Public Function SendMail(ByVal CommaDelimitedR ecipients As String, _
ByVal Subject As String, ByVal Body As String) As Boolean Implements
IQPWMessageSend er.SendMail

Dim recipients As String()

Dim oSession As New MAPI.Session
oSession.Logon( "", "", False, True, 0, True, mExchangeServer & vbLf
& mMailbox)

Dim oOutbox As Object
oOutbox = oSession.Outbox

Dim oMessage As MAPI.Message

oMessage = oOutbox.Message s.Add
oMessage.Subjec t = Subject
oMessage.Text = Body

Dim oRecipient As Object

recipients =
QPWDataHelper.C SVToStringArray (CommaDelimited Recipients)
recipients = QPWMessage.Remo veDups(recipien ts)

Dim recip As String
For Each recip In recipients
If Trim(recip) <> "" Then
oRecipient = oMessage.Recipi ents.Add
oRecipient.Name = Trim(recip.ToSt ring)
oRecipient.Reso lve()
oRecipient = Nothing
End If
Next

If recipients.Leng th > 0 Then
Try
oMessage.Send()
Catch ex As Exception
QPWLog.WriteToL og("Mapi error" & ex.Message)
End Try
Else
QPWLog.WriteToL og("Did not send MAPI message as there were no
recipients.")
End If

oSession.Logoff ()

oMessage = Nothing
oOutbox = Nothing
oSession = Nothing

End Function

End Class
'--------------------------------------
Nov 18 '05 #1
0 2224

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7184
by: Kurt | last post by:
Hi I am using CDO 1.21 from C# in order to iterate through the entries in a users outlook address book (as OOM was too slow). Basically I take the Name field from each "message" and insert it into a ListBox. I shall paste my code at the end, and describe my problem first If I call my MAPI.Sessions Logoff method when I have finished using it,...
8
3404
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be added. Converting the type library to a .Net assembly failed. A depended type library 'CDO' could not be converted to a .NET assembly. A dependent...
1
3794
by: W1ld0ne [MCSD] | last post by:
Using CDO from inside a .Net application works fine until you try to give it a strong name, then it wants to give your interop.CDO object a strong name as well and that can not be done (I think). Like you get ADO.Net, do you get CDO.Net or do I have to use CDONTS.Net Thanks David
4
5893
by: Vittorio Pavesi | last post by:
Hello, I'm using CDO in my VB Application. Does anybody know how to set the Mail priority (Urgent, Medium, Low) ?? Thanks Vittorio ---------------------------------------------------------------------------- -------------------------------- Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
8
2681
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003. Anybody has an ideal? Dim outlookMsg AsMicrosoft.Office.Interop.Outlook.MailItem Dim adoMsg As MAPI.Message outlookMsg =...
8
13974
by: Philip Wagenaar | last post by:
I need Interop.MAPI.dll for a project, but where can I find this file?
11
2174
by: Steve Smith | last post by:
I have written a winforms application that launches approximately 150 threads with Thread.ThreadStart() Each thread uses CDO 1.21 to logon to a different Exchange mailbox and send/receive a number of mail messages, reporting back to the UI thread through the use of a Queue object. When all messages that are expected have been received,...
5
8434
by: muriwai | last post by:
Hi, I have a C# assembly project under Visual Stuio 2008 Pro on Windows Server 2008. I converted the project from VS 2005. The project references COM->Microsoft CDO for Windows 2000 Library 1.0, which adds two entries under References called CDO and ADODB. When I compile the solution, I get the following: Error 1 Assembly 'Interop.CDO,...
4
3102
by: Christiano Donke | last post by:
i'm writing an app that uses an excel interop to convert the xls file to html.. while writing it, i had no problem... it problem is coming out when i try do deploy it... i've tried merging it with the .dll files, PIA files, installed office (test environment), but the system only returns that the COM isn't registered... i've tried...
0
7693
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
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
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
7665
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
5217
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
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
0
933
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.