是的,您可以使用 Exchange Web 服务来执行此操作,我推荐使用托管 API。在此处下载:http: //www.microsoft.com/download/en/details.aspx?id=13480,文档在此处:http: //msdn.microsoft.com/en-us/library/dd633710%28EXCHG.80 %29.aspx
在这里你怎么能做到。首先包括正确的命名空间:
// use the exchange library:
using System.Security.Cryptography.X509Certificates;
using Microsoft.Exchange.WebServices.Data;
然后写一些类似这样的代码:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
// If you've got a dodgy SSL cert on your exchange box then do this:
System.Net.ServicePointManager.ServerCertificateValidationCallback =
delegate(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors)
{
return true;
};
service.Credentials = new WebCredentials(Username, Password, domain);
service.Url = new Uri(url);
// this will fail if the username+password are incorrect:
Folder.Bind(service, WellKnownFolderName.MsgFolderRoot);