我尝试更新日历约会时收到Parameter name: key
的内部服务器错误。它不能为空。这是什么意思?没有参数“键”。是否报告
值?当在SO上浏览参数名称'键'不能为空时,我发现这可能是Exchange Server本身的编程错误。
select @@version
给出:Microsoft SQL Server 2016(SP1-CU2)(KB4013106)-13.0.4422.0(X64)2017年3月6日14:18:16版权所有(c)Microsoft CorporationWindows Server 2012 R2 Standard 6.3(内部版本9600:)(管理程序)上的标准版(64位)
这是响应:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="2814" MinorBuildNumber="22" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body>
<m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:UpdateItemResponseMessage ResponseClass="Error">
<m:MessageText>An internal server error occurred. The operation failed., Value cannot be null.
Parameter name: key</m:MessageText>
<m:ResponseCode>ErrorInternalServerError</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:UpdateItemResponseMessage>
</m:ResponseMessages>
</m:UpdateItemResponse>
</s:Body>
</s:Envelope>
对此请求:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2010"/>
<typ:MailboxCulture>en-US</typ:MailboxCulture>
<typ:TimeZoneContext>
<typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
</typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone">
<mes:ItemChanges>
<typ:ItemChange>
<typ:ItemId Id="AQMkAGMz[snip]AAAA==" ChangeKey="DwAA[snip]JuniP+" />
<typ:Updates>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Subject"/>
<typ:CalendarItem>
<typ:Subject>Gewijzigde afspraak? Ik denk het wel</typ:Subject>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Sensitivity"/>
<typ:CalendarItem>
<typ:Sensitivity>Normal</typ:Sensitivity>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Categories"/>
<typ:CalendarItem>
<typ:Categories>
<typ:String>TimeTell</typ:String>
</typ:Categories>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="item:Body"/>
<typ:CalendarItem>
<typ:Body BodyType="Text">Aangemaakt door Wendy</typ:Body>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:Location"/>
<typ:CalendarItem>
<typ:Location></typ:Location>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:IsAllDayEvent"/>
<typ:CalendarItem>
<typ:IsAllDayEvent>false</typ:IsAllDayEvent>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:Start"/>
<typ:CalendarItem>
<typ:Start>2020-03-31T16:56:27.929+02:00</typ:Start>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:End"/>
<typ:CalendarItem>
<typ:End>2020-03-31T17:56:27.929+02:00</typ:End>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:LegacyFreeBusyStatus"/>
<typ:CalendarItem>
<typ:LegacyFreeBusyStatus>Busy</typ:LegacyFreeBusyStatus>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:StartTimeZone"/>
<typ:CalendarItem>
<typ:StartTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:CalendarItem>
</typ:SetItemField>
<typ:SetItemField>
<typ:FieldURI FieldURI="calendar:EndTimeZone"/>
<typ:CalendarItem>
<typ:EndTimeZone TimeZoneName="W. Europe Standard Time"/>
</typ:CalendarItem>
</typ:SetItemField>
</typ:Updates>
</typ:ItemChange>
</mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
</soapenv:Envelope>
哇,这真是不可预测的。
我用nSoftware的THTTPReqResp
中的TipwHTTP
替换了IPWorks组件。这将使用所有普通的String类型。
但是发送到EWS的数据必须是UTF-8
毕竟我们说设置ContentType := 'text/xml; charset=utf-8'
*。转换后,我的代码读取
lHTTP.PostData := FSoapRequest; // A string type
但应该是
lHTTP.PostDataB := BytesOf(UTF8Encode(FSoapRequest)); // UTF8Encode returns a UTF-8 encoded RawByteString with a code page of CP_UTF8 (65001) assigned to it.
我通过仔细查看失败的SOAP调用发现了这一点。它们包含单词“左单引号”(U-2018,人们只是将Word文本复制/粘贴到电子邮件中),甚至是诸如é和ü这样的简单变音符号引起了这些错误。
*是的,'utf-8'不带引号,因为这就是Exchange Webservices想要的]]] >> 注意: