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."