2

我想使用 .NET 3.5 访问交换服务器。这是我的代码:

class Program
{
    static void Main(string[] args)
    {
        try
        {
            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
            service.Credentials = new WebCredentials("email_test@xxx.com", "abcd");

            service.AutodiscoverUrl("email_test@xxx.com");

            EmailMessage message = new EmailMessage(service);
            message.Subject = "Interesting";
            message.Body = "The proposition has been considered.";
            message.ToRecipients.Add("abc@xxx.com");
            message.SendAndSaveCopy();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }
}

我指的是这篇文章来编写代码:

但我收到了这个例外:

AutodiscoverLocalException:找不到自动发现服务。

任何人都可以帮忙吗?

4

2 回答 2

1

我遇到了这个问题,这是由于用户帐户被锁定。

于 2012-08-13T18:59:59.610 回答
1
service.Credentials = new WebCredentials("<loginID..not email address>", "< the pw>");
service.AutodiscoverUrl("<your emailaddress>",RedirectionUrlValidationCallback);
于 2017-12-20T18:05:48.587 回答