0
我正在開發一個控制檯應用程序,它將監視Exchange服務器並從新電子郵件下載附件(XML文件)。我爲此使用了EaGetmail。 附件正在下載到目標文件夾,但它是空的。尋找解決方案。 這是我的示例代碼,任何建議請。EWS使用EaGetmail下載的Xml附件爲空
private static void CheckInboxforEmail()
{
// Use domain\user as the user name
MailServer oServer = new MailServer("MailID", "domain","Pwd",ServerProtocol.ExchangeEWS);
MailClient oClient = new MailClient("TryIt");
oServer.SSLConnection = true;
try
{
oClient.Connect(oServer);
MailInfo[] infos = oClient.GetMailInfos();
for (int i = 0; i < infos.Length; i++)
{
MailInfo info = infos[i];
// Receive email from Exchange server
Mail oMail = oClient.GetMail(info);
//SaveAttachments
foreach (EAGetMail.Attachment Att in oMail.Attachments)
{
string AttName = String.Format("{0}\\{1}", WIPFolder,Att.Name);
oMail.SaveAs(AttName, true);
}
// Delete email from EWS server.
oClient.Delete(info);
}
// Quit from Exchange server.
oClient.Quit();
}
catch (Exception ep)
{
}
}