Office.context.mailbox.item.getSelectedDataAsync未在已安装的Outlook中返回选定的数据

时间:2018-02-06 10:16:19

标签: outlook ms-office office-js office-js-helpers

根据提供的文件, Office.context.mailbox.item.getSelectedDataAsync(Office.CoercionType.Text, {}, getCallback)应该从邮箱的正文或主题返回选定的数据。相反,callbackasyncResult.value.data中返回一些html标记,此问题仅在已安装的Outlook中。

然而,这在浏览器应用程序中运行良好,它会正确地返回asyncResult.value.data中的选定数据。

有人可以向我解释为什么只在已安装的Outlook中出现此问题?可能我可能会遗漏一些东西,请澄清。

返回

html标记而不是选定的数据:

"<html>\r\n\r\n<head>\r\n<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">\r\n<meta name=Generator content=\"Microsoft Word 15 (filtered)\">\r\n<style>\r\n<!--\r\n /* Font Definitions */\r\n @font-face\r\n\t{font-family:\"Cambria Math\";\r\n\tpanose-1:2 4 5 3 5 4 6 3 2 4;}\r\n@font-face\r\n\t{font-family:Calibri;\r\n\tpanose-1:2 15 5 2 2 2 4 3 2 4;}\r\n /* Style Definitions */\r\n p.MsoNormal, li.MsoNormal, div.MsoNormal\r\n\t{margin:0cm;\r\n\tmargin-bottom:.0001pt;\r\n\tfont-size:11.0pt;\r\n\tfont-family:\"Calibri\",sans-serif;}\r\na:link, span.MsoHyperlink\r\n\t{color:#0563C1;\r\n\ttext-decoration:underline;}\r\na:visited, span.MsoHyperlinkFollowed\r\n\t{color:#954F72;\r\n\ttext-decoration:underline;}\r\nspan.EmailStyle17\r\n\t{font-family:\"Calibri\",sans-serif;\r\n\tcolor:windowtext;}\r\n.MsoChpDefault\r\n\t{font-family:\"Calibri\",sans-serif;}\r\n@page WordSection1\r\n\t{size:612.0pt 792.0pt;\r\n\tmargin:72.0pt 72.0pt 72.0pt 72.0pt;}\r\ndiv.WordSection1\r\n\t{page:WordSection1;}\r\n-->\r\n</style>\r\n\r\n</head>\r\n\r\n<body lang=EN-IN link=\"#0563C1\" vlink=\"#954F72\">\r\n\r\n<div class=WordSection1>\r\n\r\n<p class=MsoNormal>dheeerldfjshfjdsfs</p>\r\n\r\n</div>\r\n\r\n</body>\r\n\r\n</html>\r\n"

屏幕截图供参考:

asyncresult

1 个答案:

答案 0 :(得分:0)

发布我的评论作为答案,正如@sudheer reddy所证实的那样。

在调试过程中,您是否检查过应用程序的JavaScript是否正在使用Office.CoercionType.Text进行调用?如果没有,请相应地更改强制类型。