hi ,
i am very new to .net world.
I wrote a code using c# ,which trys to access the emails from exchange server public folder i am getting the below exception:
System.Runtime. InteropServices .COMException (0xC0048108)
at ADODB.Recordset Class.Open(Obje ct Source, Object ActiveConnectio n, CursorTypeEnum CursorType, LockTypeEnum LockType, Int32 Options)
and i tried the sample code as shown below. exception is caused at
recordset open request.
using System;
namespace Samples
{
class Class1
{
static void Main(string[] args)
{
try
{
ADODB.Connectio n oCn = new ADODB.Connectio n();
ADODB.Recordset oRs = new ADODB.Recordset ();
ADODB.Fields oFields;
ADODB.Field oField;
// TODO:
string sFdUrl = "http://ExchServer/Exchange/UserAlias/Inbox";
oCn.Provider = "exoledb.dataso urce";
oCn.Open(sFdUrl , "", "", -1);
if(oCn.State == 1)
{
Console.WriteLi ne("Good Connection");
}
else
{
Console.WriteLi ne("Bad Connection");
}
string strSql;
strSql = "";
strSql = "select ";
strSql = strSql + " \"urn:schemas:m ailheader:conte nt-class\"";
strSql = strSql + ", \"DAV:href\" ";
strSql = strSql + ", \"urn:schemas:m ailheader:conte nt-class\" ";
strSql = strSql + ", \"DAV:displayna me\"";
strSql = strSql + " from scope ('shallow traversal of " + "\"";
strSql = strSql + sFdUrl + "\"') ";
strSql = strSql + " WHERE \"DAV:ishidden\ " = false";
strSql = strSql + " AND \"DAV:isfolder\ " = false";
oRs.Open(strSql , oCn,
ADODB.CursorTyp eEnum.adOpenUns pecified,
ADODB.LockTypeE num.adLockOptim istic, 1);
// As an example, you only retrieve the first message.
// You can use a while loop through each message.
// Get the first message.
oRs.MoveFirst() ;
// Get Recordset fields.
oFields = oRs.Fields;
string sUrl;
oField = oFields["DAV:href"];
sUrl = oField.Value.To String();
CDO.Message iMsg = new CDO.Message();
iMsg.DataSource .Open(sUrl, oRs.ActiveConne ction,
ADODB.ConnectMo deEnum.adModeRe adWrite,
ADODB.RecordCre ateOptionsEnum. adFailIfNotExis ts,
ADODB.RecordOpe nOptionsEnum.ad OpenSource,
"", "");
Console.WriteLi ne("{0}", iMsg.Sender);
Console.WriteLi ne("{0}", iMsg.Subject);
Console.WriteLi ne("{0}", iMsg.TextBody);
// Get message fields.
oFields = iMsg.Fields;
for(int i = 0; i < oFields.Count; i++)
{
oField = oFields[i];
Console.WriteLi ne("{0} : {1}", oField.Name, oField.Value);
}
oRs.Close();
oCn.Close();
oCn = null;
oRs = null;
oFields = null;
oField = null;
}
catch (Exception e)
{
Console.WriteLi ne("{0} Exception caught.", e);
}
}
}
}
can any one help me please ???
Thanks
Anand.
0 1494 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Brian Henry |
last post by:
To use the SMTP mail service from System.Web.Mail do you have to have IIS
installed on the client machien? I wanted my app to email any errors that
may of occured to me on the clients machines in the application but now it
is popping up with CDO errors (even on the machine it was working on
originally)
|
by: marcmc |
last post by:
Trying to send an eMail frommy vb.net App.
Is there anybody out there that has successfully done this?
I am having major problems and need a step by step guide into the world of
system.web and IIS. The reading I have done(alot) has been pretty useless in
helping me understand the various bits required.
The error I get is: On a pc running win2k with IIS and Lotus Notes
System.Runtime.InteropServices.SEHException: External component has...
|
by: Ryan |
last post by:
Hi,
I receive an access denied error (see below) when attempting to send an
email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same
code works fine in a console application, and also succeeds from the asp.net
page with BodyFormat=MailFormat.Text.
I've recently upgraded from W2K SP4 to WinXP SP2 and am using .Net Framework
v1.1 SP1. The code worked fine under W2K SP4.
|
by: Yong |
last post by:
I have a COM DLL written in C++ which worked fine when called from VB6. But
we have now moved to Visual Studio 2005 - .NET Framework v2 and Windows XP
Pro. In total there are 4 methods in this DLL which I can call, 3 of which
have no return paramters as arguments (ByRef), these work fine, its only the
method that uses 2 passed in paramters (Long - ByRef) to return the the
required data that causes an exception.
So from my VB.NET program:...
|
by: umeshatpromact |
last post by:
Hello!,
I got following exception when using COM component for EXCEL object in ASP .Net.
I have added reference of "Microsoft.Office.Interop.Excel.dll"
I deployed an application on local server
When i create an instance of Application class, i am getting following detailed error:
| |
by: sasikumarks |
last post by:
Hi,
Im using the following code to retrieve the user details from the AD server. But when i execute the code,it throws me the error. Please help me in this regards."System.Runtime.InteropServices.COMException (0x8007052E): Logon failure: unknown user name or bad password. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at...
|
by: bharathreddy |
last post by:
Hi,
Why do we get System.Runtime.InteropServices.COMException.
Simple terms exception is thrown when an unrecognized HRESULT is returned from a COM method call. Apart from this is there any other kind of explanation.
Thanks & Regs
Bharath Reddy VasiReddy
|
by: sriregu |
last post by:
Hi,
i am trying the exe file in .net environment and am getting the following error.Any idea how i can resolve it?
System.Runtime.InteropServices.COMException (0x80040154): Class not registered
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at...
|
by: =?Utf-8?B?am1hZ2FyYW0=?= |
last post by:
I have a Windows service written in C# that is configured to automatically
start. Sometimes - maybe 20% of the time - the service fails to start due to
an exception in WMI code. I haven't made my service dependent on WMI (or any
other service) because it appears that .net WMI calls automatically start the
WMI service if necessary. Below are the details. What causes this? How can I
make this code work 100% of the time? The code is trying to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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...
|
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...
|
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();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |