0
            // Global variables
            var _Item;
            var _MyEntities;

            // The initialize function is required for all apps.
            Office.initialize = function (reason) {
                var _mailbox = Office.context.mailbox;
                // Obtains the current item.
                Item = _mailbox.item;
                // Reads all instances of supported entities from the subject
                // and body of the current item.
                MyEntities = _Item.getEntities();

                // Checks for the DOM to load using the jQuery ready function.
                $(document).ready(function () {
                // After the DOM is loaded, app-specific code can run.
                });
            }

            // Gets instances of the Address entity on the item.
            function myGetAddresses()
            {
                var htmlText = "";

                // Gets an array of postal addresses. Each address is a string.
                var addressesArray = _MyEntities.addresses;
                for (var i = 0; i < addressesArray.length; i++)
                {
                    htmlText += "Address : <span>" + addressesArray[i] + "</span><br/>";
                }

                document.getElementById("entities_box").innerHTML = htmlText;
            }

我正在使用上面的代码访问电子邮件地址,但我无法在 entity_box div 中看到任何结果。

请建议我怎样才能从它的电子邮件地址获取、抄送和从电子邮件地址获取。

4

1 回答 1

0

仅当消息本身已提取实体时,实体才可用(例如,“123 Main st, New York, New York 10001”)。我将首先检查是否确实检测到地址来开始调试(Bing Maps 应用程序是否在该消息上激活?您是否将其保持启用状态?)。然后,调用 json.stringify 并查看 item.getEntities() 实际返回的内容。这是一篇关于如何提取实体的文章:http: //msdn.microsoft.com/en-us/library/office/fp161071 (v=office.15).aspx

于 2014-03-17T04:22:33.467 回答