办公室展望(网站)显示消息详情

时间:2017-06-21 12:29:01

标签: fabricjs outlook-addin office-js

我开发了我的第一个办公室Outlook web插件。我使用VisualStudio2017和Office2016。当我点击Outlook中的电子邮件时,我试图实现的目的是显示电子邮件数据,如发件人姓名,电子邮件,收件人姓名,电子邮件和完整的电子邮件消息。我应该有可能将完整的电子邮件文件下载为.eml文件。我用更新了AddInManifest文件      以下内容 `

<Control xsi:type="Button" id="messageDetailsService">
                      <Label resid="messageDetailsLabel"/>
                      <Supertip>
                          <Title resid="messageDetailsTitle"/>
                          <Description resid="messageDetailsDesc"/>
                      </Supertip>
                      <Icon>
                          <bt:Image size="16" resid="icon16"/>
                          <bt:Image size="32" resid="icon32"/>
                          <bt:Image size="80" resid="icon80"/>
                      </Icon>
                      <Action xsi:type="ShowTaskpane">
                             <SourceLocation resid="sendMessage"/>
                      </Action>
                  </Control>`
also update <bt:Url> to point to "SendMessage" html page . 

<bt:Url id="sendMsgToService" DefaultValue="~remoteAppUrl/SendMessageService.html"/>

Javascript代码:

    (function () {
        "use strict";
     Office.initialize = function (reason) {
            $(document).ready(function () {
                app.initialize();

                displayItemDetails();
            });
        };

       function displayItemDetails() {
                var item = Office.cast.item.toItemRead(Office.context.mailbox.item);
                $('#subject').text(item.subject);

                var from;
                if (item.itemType === Office.MailboxEnums.ItemType.Message) {
                    from = Office.cast.item.toMessageRead(item).from;
                } else if (item.itemType === Office.MailboxEnums.ItemType.Appointment) {
                    from = Office.cast.item.toAppointmentRead(item).organizer;
                }

                if (from) {
                    $('#from').text(from.displayName);
                    $('#from').click(function () {
           app.showNotification(from.displayName, from.emailAddress);
                    });
                }
            }
        })();

HTML:
<div id="content-main">
    <div class="padding">
        <p><strong>Add home screen content here.</strong></p>
        <p>For example, this app was activated with following details:</p>
        <table id="details">
            <tr>
                <th>Subject:</th>
                <td id="subject"></td>
            </tr>
            <tr>
                <th>From:</th>
                <td id="from"></td>
            </tr>
        </table>
    </div>
</div>

运行项目后,我可以看到AddIn,当我点击它时打开TaskPane,但我没有得到任何电子邮件的值。请告诉我这里做错了什么,但奇怪的是同样的代码工作VS2015但不在VS2017

0 个答案:

没有答案