javascript - 使用 ews-javascript-api 更新交流 session 时出错

标签 javascript exchangewebservices ews-javascript-api

我正在使用 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/

相关文章:

javascript - 当我在 Javascript 中编写循环检查代码时,如何避免在定义这些函数之前使用它们?

javascript - 使用 setTimeout() 在 React 中渲染一个带有超时的列表

javascript - 按钮仅在用户对某个数字进行评分时才会出现或启用?

javascript - React onClick 函数参数变成 "Proxy"对象

java - Exchange Web 服务 GetAttachment 不会流式传输到磁盘

python - O365 EO 可恢复项目文件夹的 REST Api

python - 使用 Exchangelib 连接到 Exchange 时出现授权错误

javascript - 如何使用 ews-javascript-api 删除个人地址簿联系人