EWS SOAP UpdateItem调用的参数名称“键"不能为空 [英] Parameter name 'key' cannot be null for EWS SOAP UpdateItem call
问题描述
尝试更新日历约会时,出现Parameter name: key
的内部服务器错误.
它不能为空".这是什么意思?没有参数键". 
是报告的值吗?
当在SO上浏览参数名'key'不能为空时,我知道这可能是Exchange Server本身的编程错误.
I'm getting an internal server error for Parameter name: key
when trying to update a calendar appointment.
It 'cannot be null'. What can this mean? There is no parameter 'key'. Is 
the value being reported on?
When browsing around on SO for Parameter name 'key' cannot be null I get the idea it could be a programming error in Exchange Server itself.
select @@version
给出:
Microsoft SQL Server 2016(SP1-CU2)(KB4013106)-13.0.4422.0(X64)
2017年3月6日14:18:16
版权所有(c)Microsoft Corporation
Windows Server 2012 R2 Standard 6.3(内部版本9600:)(管理程序)上的Standard Edition(64位)
select @@version
gives:
Microsoft SQL Server 2016 (SP1-CU2) (KB4013106) - 13.0.4422.0 (X64)
Mar 6 2017 14:18:16
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: ) (Hypervisor)
这是响应:
<?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>
推荐答案
哇,这真是不可预测的.
Wow, this was really unpredictable.
我已经用nSoftware的 IPWorks 中的TipwHTTP
替换了THTTPReqResp
组件.这将使用所有普通的String类型.
I had replaced the THTTPReqResp
components, with TipwHTTP
from nSoftware's IPWorks. This uses all ordinary String types.
但是发送到EWS的数据必须为UTF-8
毕竟我们说设置ContentType := 'text/xml; charset=utf-8'
* .
转换后,我的代码仍为:
After all we say set ContentType := 'text/xml; charset=utf-8'
*.
After the conversion my code still read:
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文本复制/粘贴到电子邮件中),甚至是诸如é和ü这样的简单变音符号引起了这些错误.
I found this out by carefully looking at the SOAP calls that failed. They contained things like the Word 'Left single quotation mark' (U-2018, people just copy/paste Word texts in to email), or even the simple diacritics like é and ü, that caused these errors.
*是的,不带引号的'utf-8',因为这是Exchange Webservices想要的
注意:
- 这是非常具体的,所以我想到了只删除问题,但是其他人也可能会遇到EWS提供的信息不超过内部服务器错误"的情况.很高兴将此作为调查的指针.
- 有限的错误信息使我提出问题 查看全文