我正在使用 ews-javascript-api 来更新约会( session )作为交换。我收到一条错误消息:
请求架构验证失败:未声明“SuppressReadReceipts”属性。
我无法在文档中找到任何向我展示如何执行此操作的内容。
我上网查了一下,没有找到任何有用的信息。
async updateExchangeItem(_json: any): Promise<any>{
EwsLogging.DebugLogEnabled = false;
service.ImpersonatedUserId = new ews.ImpersonatedUserId(ews.ConnectingIdType.SmtpAddress, "myconferenceroom@me.com");
var id = 'abcdefg';
var mailbox = new Mailbox("myconferenceroom@me.com");
var primaryCal = Folder.Bind(service, new FolderId(WellKnownFolderName.Calendar, mailbox), new PropertySet());
var meeting = await Appointment.Bind(service, new ItemId(id), ).then((response) =>{
if (response) {
response.Subject = 'my subject';
response.Start = new ews.DateTime('08/28/2019 8:00 am');
response.End = new ews.DateTime('08/28/2019 9:00 am');
response.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy).then(response =>{
console.log("worked");
return("worked");
}).catch((error) => {
console.log(error);
});
}
});
return("done");
}
以下是完整的错误消息:
SoapFaultDetails {
message: 'The request failed schema validation.',
InnerException: null,
faultCode: 'a:ErrorSchemaValidation',
faultString:
{ 'xml:lang': 'en-US',
faultstring:
'The request failed schema validation: The \'SuppressReadReceipts\' attribute is not declared.' },
faultActor: null,
responseCode: 355,
errorCode: 0,
exceptionType: null,
lineNumber: 1,
positionWithinLine: 541,
errorDetails:
DictionaryWithStringKey {
keys: [ 'Violation' ],
keysToObjs: { Violation: 'Violation' },
objects:
{ Violation: 'The \'SuppressReadReceipts\' attribute is not declared.' },
keyPicker: [Function] },
HttpStatusCode: 500 }
最佳答案
它看起来像是源代码中的错误,例如看看
https://github.com/gautamsi/ews-javascript-api/blob/master/src/js/Core/Requests/UpdateItemRequest.ts
具体
if (hasValue(this.SuppressReadReceipts)) {
writer.WriteAttributeValue(XmlAttributeNames.SuppressReadReceipts, true);
}
这是一个可选值,仅在更新项目时有效,默认为 false。如果您查看原始来源https://github.com/OfficeDev/ews-managed-api/blob/master/Core/Requests/UpdateItemRequest.cs 。您应该做的是在检查是否有一个值后,仅在该值为 true 时设置该属性(这就是原始值),而不是设置是否有任何值为 true。
关于javascript - 使用 ews-javascript-api 更新交流 session 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57485520/