简体   繁体   English

EWS Exchange Web服务API AutodiscoverUrl异常

[英]EWS Exchange Web service API AutodiscoverUrl exception

I get an error when I try to create an appointment: 我尝试创建约会时收到错误:

The expected XML node type was XmlDeclaration, but the actual type is Element. 预期的XML节点类型是XmlDeclaration,但实际类型是Element。

This Exception occurs when I call AutodiscoverUrl . 当我调用AutodiscoverUrl时会发生此异常。
I created a web service to do this. 我创建了一个Web服务来执行此操作。

[webMethod]
CreateAppointment()
{
    var service = new ExchangeService(ExchangeVersion.Exchange2007_SP1)
    {
        Credentials = new WebCredentials("myAcount@gmail.com", "mypassowrd")
    };

    service.AutodiscoverUrl("myAcount@gmail.com");

    //----------------------------------------------------------------------
    var app = new Appointment(service)
    {
        Subject = "Meet George",
        Body = "You need to meet George",
        Location = "1st Floor Boardroom",
        Start = DateTime.Now.AddHours(2),
        End = DateTime.Now.AddHours(3),
        IsReminderSet = true,
        ReminderMinutesBeforeStart = 15
    };
    app.RequiredAttendees.Add(new Attendee("any@gmail.com"));
    app.Save(SendInvitationsMode.SendToAllAndSaveCopy);
}

Some potential answers. 一些潜在的答案。

  1. Passing in the wrong url or domain. 传入错误的网址或域名。
  2. Passing in a bad email address. 传递错误的电子邮件地址。
  3. Rebuilding the Windows Profile can sometimes help. 重建Windows配置文件有时可以提供帮助。 (Warning: have an IT Admin do this). (警告:请IT管理员执行此操作)。 And it might be overkill. 它可能有点矫枉过正。
  4. A user could have an old, bad, or multiple outlook profiles set up. 用户可以设置旧的,坏的或多个Outlook概要文件。 The email server name could be bad in the outlook profile. outlook配置文件中的电子邮件服务器名称可能不正确。 (See Control Panel > Mail) (请参阅控制面板>邮件)

Autodiscover depends on two things: 自动发现取决于两件事:

  1. DNS entries that point from the users mail domain to the Autodiscover data on the Exchange server. 从用户邮件域指向Exchange服务器上的自动发现数据的DNS条目。 Typically you would have a DNS entry with the name autodiscover.domain.com, but there's more than one way of setting this up for different versions of Exchange. 通常,您将拥有一个名为autodiscover.domain.com的DNS条目,但是有不止一种方法可以为不同版本的Exchange设置此条目。 If the correct DNS entry doesn't exist, auto-discovery will fail. 如果不存在正确的DNS条目,则自动发现将失败。

  2. Autodiscover data hosted on the Exchange server (I believe it's an XML file) and accessed over HTTP. 托管在Exchange服务器上的自动发现数据(我相信它是一个XML文件)并通过HTTP访问。 If this isn't accessible (perhaps it's behind a firewall) then auto-discovery will fail. 如果无法访问(可能它位于防火墙后面),则自动发现将失败。

Check the appropriate DNS entries and autodiscover information is accessible to your client. 检查适当的DNS条目,并且客户端可以访问自动发现信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM