473,320 Members | 2,189 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Working in Exchange 2000 with C#

Hey folks,

I'm only beginning to understand the ins and outs of programming, let alone
C# and thing like ADO/CDO etc etc, but I'm on my way to trying to develop a
User Help Desk solution on Exchange 2000/2003 using C#.

I understand that E2K doesn't support ADO.Net (despite being a ".Net
Enterprise Server" or whatever), so would someone be able to point me in the
right direction for an easy way to work with Exchange messages, contacts and
folders which will minimise the work required in changing to Exch2003. One
person suggested WebDAV and XML but frankly I'm having a lot more difficulty
with that kind of stuff than I am with the old ADO!

Thanks in advance... oh, and if anyone can supply some code to extract a
list of messages from a folder that would be super (in the words of Big Gay
Al). :-)

Ferg.
Nov 15 '05 #1
1 5012
Hi Freg,

Since you are familiar with ADO to exchange, you can still use them in C#
application through interop. For example, add CDO and ADO in COM
references, and with following code:

using System;

namespace Samples
{
class Class1
{
static void Main(string[] args)
{
try
{
ADODB.Connection oCn = new ADODB.Connection();
ADODB.Recordset oRs = new ADODB.Recordset();

ADODB.Fields oFields;
ADODB.Field oField;

// TODO: Replace with your folder URL
string sFdUrl = "http://ExchServer/exchange/UserAlias/Inbox";

oCn.Provider = "exoledb.datasource";
oCn.Open(sFdUrl, "", "", -1);
string strSql;
strSql = "";
strSql = "select ";
strSql = strSql + " \"urn:schemas:mailheader:content-class\"";
strSql = strSql + ", \"DAV:href\" ";
strSql = strSql + ", \"DAV:displayname\"";
strSql = strSql + " from scope ('shallow traversal of " + "\"";
strSql = strSql + sFdUrl + "\"') ";
strSql = strSql + " WHERE \"DAV:ishidden\" = false";
strSql = strSql + " AND \"DAV:isfolder\" = false";
strSql = strSql + " AND \"DAV:displayname\" = 'Test.eml'"; // TODO:
oRs.Open(strSql, oCn,
ADODB.CursorTypeEnum.adOpenUnspecified,
ADODB.LockTypeEnum.adLockOptimistic,
1);

Console.WriteLine(oRs.RecordCount);

oRs.MoveFirst();
while(!oRs.EOF)
{

oFields = oRs.Fields;

oField = oFields["DAV:href"];
Console.WriteLine(oField.Value);

oField = oFields["DAV:displayname"];
Console.WriteLine(oField.Value);

oRs.Delete(ADODB.AffectEnum.adAffectCurrent);

oRs.MoveNext();
Console.WriteLine("Item Deleted");
Console.WriteLine("--------------------------");

}

oCn.Close();

oCn = null;
oField = null;
oFields = null;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
}
}
}
}
Some KB article on this issue will be released soon, on how to access
exchange server with C#.
Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/se...s/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."

Nov 15 '05 #2

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

Similar topics

0
by: Chris | last post by:
I am trying to solve the following problem using c#: One of our customers sends orders using mail attachments. When these attachments arrive at their designated mail account on our exchange...
0
by: Nitec Dev | last post by:
Our setup: server1 ASP database running on IIS5, Outlook 2000 and SQL 2000 on Windows 2000. Server2 runs Windows 2000 with Exchange 2000 using CDO 1.2 MAPI Sessions. Clients use IE5/6 and had...
2
by: Mick Kehoe | last post by:
Hi All We are running SQL Server & Outlook with an exchange server. We are looking for a way to import the address book & email details into a database table. We have managed to do this with...
6
by: Jason | last post by:
Sorry for the post here but could not find an Exchange newgroup. I developed an application a year or 2 ago that sends SMTP email. The application allows the user to customize the text from...
1
by: Jim in Arizona | last post by:
I have no idea how to get started, really, but I am looking for a way to have an email sent via an ASP page via our Exchange 2000 server. I have a fairly simple asp page that displays data from a...
1
by: Arran Pearce | last post by:
I am wanting to create a web application which will use Microsoft Exchange Server. We currently use Exchange 2000 but if i needed it we would upgrade to 2003. Is 2003 going to provide easyer...
1
by: Notlwonk | last post by:
Not sure where to post this Q I am trying to write a Managed Exchange Server Event Sink (as a class library) in C# I have been following this tutorial step-by-step ...
0
by: JimDuggan | last post by:
I've written an event sink for Exchange 2000 in managed code, but have found problems now I've come to test it. My Exchange box needs upgrading to SP3 so I can install the Exchange SDK tools...
1
by: Robbert van Geldrop | last post by:
Hello, I have a problem restoring Exchange 2000 files. Our software has an interface to ESEBCLI2.dll for online backup and restore features. Everything works fine with Exchange 2003 and also...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.