Office.context.mailbox.item.to.getAsync updates TO field with partial data

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 05:37:53

问题


I start typing in Outlook TO field and at the same moment query every 1s TO field from the installed Add-in.

While I'm still typing I expect to receive an empty array but Outlook (office-js SDK):

  1. Returns data with empty emailAddress and typed displayName
  2. Creates new address with partially typed displayName and incorrect emailAddress generated from typed data.

I can handle the first issue but how to prevent the second one?
Executed code:

Office.cast.item.toItemCompose(Office.context.mailbox.item).to.getAsync(res => {
        if(res.status === Office.AsyncResultStatus.Succeeded) {
                console.log(res.value[0].emailAddress+res.value[0].displayName);
       }
});

Environment:

  • Platform: PC desktop
  • Host: Outlook
  • Office version number: 16
  • Operating System: Windows 10

Issue in Github: https://github.com/OfficeDev/office-js/issues/79


回答1:


@trustifi-trustifi Thanks for reporting this issue.

No. 1 is a known issue that was fixed in build 16.0.8309.1000. If you are still seeing that issue, you are probably on an older version of Outlook, so you will need to upgrade.

For no. 2, I looked at your GitHub post, and you had "test@google.c" as an example of a partially typed display name / incorrect email address. Technically, "test@google.c" is a valid email address, so it can be returned as a recipient once it is resolved by Outlook.

If I have misunderstood your no. 2 question, you have my apologies. Kindly clarify further so that I can provide a better answer.

Overall, instead of polling every 1 second, you need an event that you can subscribe to, so that your add-in is notified when there's a change in recipients. We are currently working on adding more events to our platform to address this issue for developers. Kindly send us a feature request on our UserVoice page.



来源:https://stackoverflow.com/questions/49537433/office-context-mailbox-item-to-getasync-updates-to-field-with-partial-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!