473,698 Members | 2,426 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 2234

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

Similar topics

4
7189
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, then this method takes between 1 and 5 minutes to execute, but after that everything is fine If...
8
3417
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 type library 'ADODB' could not be converted to a .NET assembly. Item has already been added." ...
1
3796
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
5897
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
2692
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 = Microsoft.Office.Interop.Outlook.Application.Session.GetItemFromID(cdoMsg.ID)
8
13989
by: Philip Wagenaar | last post by:
I need Interop.MAPI.dll for a project, but where can I find this file?
11
2205
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, each thread sends a final update to the UI and the method should exit, which should terminate the...
5
8439
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, Version=1.0.0.0, Culture=neutral,
4
3104
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 merging the gacutil.exe to register, but didn't work...
0
8678
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3052
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
3
2007
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.