Я использую ExchangeService WebService API ( Microsoft.Exchange.WebServices.Data
), но не могу найти ни одного Close
или Dispose
] метод.
Разве не обязательно как-то закрывать соединение?
Мой метод выглядит так:
public void CheckMails()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
IMAPCredentials creds = new IMAPCredentials();
service.Credentials = new NetworkCredential(creds.User, creds.Pass, creds.Domain);
service.AutodiscoverUrl(creds.User + "@example.com");
// not the real code from here on but you'll get the idea...
// var emails = service.FindItems();
// emails[0].Load();
// emails[0].Attachments[0].Load();
// ...
}