我想使用.NET 3.5访问Exchange服务器。这是我的代码:
class Program
{
static void Main(string[] args)
{
try
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.Credentials = new WebCredentials("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96f3fbf7fffac9e2f3e5e2d6eeeeeeb8f5f9fb" rel="noreferrer noopener nofollow">[email protected]</a>", "abcd");
service.AutodiscoverUrl("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8ddd5d9d1d4e7ccddcbccf8c0c0c096dbd7d5" rel="noreferrer noopener nofollow">[email protected]</a>");
EmailMessage message = new EmailMessage(service);
message.Subject = "Interesting";
message.Body = "The proposition has been considered.";
message.ToRecipients.Add("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7868584a79f9f9fc984888a" rel="noreferrer noopener nofollow">[email protected]</a>");
message.SendAndSaveCopy();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
我指的是this article编写代码:
但是我收到了这个异常:
AutodiscoverLocalException: The Autodiscover service couldn't be located.
有人可以帮忙吗?
最佳答案
我遇到了这个问题,这是由于用户帐户被锁定所致。
关于c# - 自动发现本地异常 : The Autodiscover service couldn't be located,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11929607/