从会议中获取开始时间和结束时间到任务面板 outlook 插件

问题描述 投票:0回答:0

我正在尝试设置从会议到任务窗格的结束时间和开始时间,为此我使用了 office js api addHandlerAsync

https://learn.microsoft.com/en-us/javascript/api/outlook/office.mailbox?view=outlook-js-1.5&preserve-view=true#outlook-office-mailbox-addhandlerasync-member(1 )

Office.context.mailbox.item.addHandlerAsync(Office.EventType.AppointmentTimeChanged, function (result:any) {
    debugger
    const items = Office.context.mailbox.item;

    items.start.getAsync( async function (result) {
      const updatedStartTime = await getMeetingTime(result.value);
     setMeetingSchedule({ ...meetingSchedule, startTime: `${updatedStartTime.toLocaleLowerCase()}` });
    
    });
    items.end.getAsync( async function (result) {
      const updatedEndTime = await getMeetingTime(result.value);
     setMeetingSchedule({ ...meetingSchedule, endTime: `${updatedEndTime.toLocaleLowerCase()}` });
    });
  });

只有 endTime 有变化并且组件重新渲染多次我已经在 useEffect 中尝试过这段代码但仍在渲染

javascript outlook outlook-addin office-addins
© www.soinside.com 2019 - 2024. All rights reserved.