我尝试更改 calenderItem,并将文本添加到 html 类型的正文中。 SetItemField 工作没有任何问题,但随后正文将被覆盖。
这是 ews 请求的正文:
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AutoResolve" MessageDisposition="SaveOnly" SendMeetingInvitationsOrCancellations="SendToNone">
<mes:ItemChanges>
<typ:ItemChange>
<typ:ItemId Id="ABMkA..." ChangeKey="DgAAA..."/>
<typ:Updates>
<typ:AppendToItemField>
<typ:FieldURI FieldURI="item:Body"/>
<typ:CalendarItem>
<typ:Body BodyType="HTML"><br>Test</typ:Body>
</typ:CalendarItem>
</typ:AppendToItemField>
</typ:Updates>
</typ:ItemChange>
</mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
我得到的回复正文是:
<s:Body>
<m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="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">
<m:ResponseMessages>
<m:UpdateItemResponseMessage ResponseClass="Error">
<m:MessageText>An internal server error occurred. The operation failed., Object reference not set to an instance of an object.</m:MessageText>
<m:ResponseCode>ErrorInternalServerError</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items />
</m:UpdateItemResponseMessage>
</m:ResponseMessages>
</m:UpdateItemResponse>
</s:Body>
itemId 和类型 (calendarItem) 正确。我的计划到底可行吗?
您无法连接两个 HTML 字符串并期望返回格式正确的 HTML 文档。您需要合并两者并替换旧值。