ASP C# Exchange Mailbox, ExOlebd, ADODB: System.Runtime.InteropSevices.COMException

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

Code:
ADODB.RecordClass userRec = new ADODB.RecordClass();
ADODB.ConnectionClass userConn = new ADODB.ConnectionClass();

string strDataURL = (string) Request.QueryString["DataURL"];

try
{
userConn.Provider = "ExOledb.DataSource";
userConn.Open(strDataURL, "UserWithPrives", "Password", -1);

try
{
userRec.Open(strDataURL, userConn,
ADODB.ConnectModeEnum.adModeShareDenyWrite,
ADODB.RecordCreateOptionsEnum.adOpenIfExists,
ADODB.RecordOpenOptionsEnum.adOpenRecordUnspecified,
"UserWithPrives",
"Password");

foreach(ADODB.Field currField in userRec.Fields)
{
try
{
Response.Write(currField.Name + " : " + currField.Value +
"<BR>" +
Environment.NewLine);
}
catch(Exception Ex)
{
Response.Write("Field Error: " + Ex.Message + "<BR>" +
Environment.NewLine);
}
}
}

Rest of the code is inmaterial to the problem.

Connection opens fine as well as record. The User with privs can read
the mailbox and has all the privs necessary. I have even given asp and
ADODB.dll the priv.

When I look at the field object the Name I can see is corect but when
I sample the Value it has the following entry:

-[ADODB.InternalField] {ADODB.InternalField} ADODB.InternalField
System.Object {ADODB.InternalField} System.Object
ActualSize <error: an exception of type:
{System.Runtime.InteropServices.COMException}
occurred> int
Attributes 0 int
DataFormat <undefined value> System.Object
DefinedSize 0 int
+ m_field {System.__ComObject} ADODB.Field
+ m_fields {ADODB.InternalFields} ADODB.InternalFields
Name "urn:schemas:mailheader:posting-version" string
NumericScale 0 byte
OriginalValue <undefined value> System.Object
Precision 0 byte
+ Properties {ADODB.InternalProperties} ADODB.Properties
Status 8 int
Type adEmpty ADODB.DataTypeEnum
UnderlyingValue <undefined value> System.Object
Value <error: an exception of type:
{System.Runtime.InteropServices.COMException} occurred>
System.Object

Desparate for an answere.
 
HI,

I think that you have to use CDO library.
This library allows to connect to the Exchange server and get everything
datas. I mean that you can get all folders and others datas.

bye
 
You don't sound confident in your reply.

Doesn't CDO use ADODB to access the data?

I will investigate your answer.

Some insight.

If I setup a test app in VB 6 it works fine but, if I revert to VB then
I wll need to use ASP which I definetly do not want to do. I have
already written the page in ASP.NET and it is quite complex convert that
to ASP and I will have a mess.

I wrote a COM in VB6 and then attempted access from ASP.NET and I get an
Access violation. This access violation probably is due to priv's of the
COM.

So in conclusion I assume that it can be done using ADODB and that I
have some sort of interop problem when I use .NET. So I thought maybe I
need to use reflection etc. etc.

I'm not lazy I just need someone to say definitevly you cannot and will
not ever be able to access the data using ADODB via .NET because blah
blh blah...

Thanks for your answer.

Jerry
 
Back
Top