如何使用 office.js 获取 Outlook 中列字段的值?

How to get the values of column fields in Outlook with office.js?

在 Outlook 中,用户可以添加将显示在收件箱视图中的内置(电子邮件大小、重要性等)或自定义列。 (https://support.office.com/en-us/article/add-or-remove-columns-in-the-inbox-78098e3e-8203-47da-815e-cb66f76b512e)

如何读取它们的值?例如,如何获取电子邮件大小?或者如何获取自定义列的值?

我已经阅读了全文 documentation reference of Outlook Javascript API,但我什么也没找到。

类别和自定义属性不是我要找的。

希望有人能帮帮我‍♂️

我使用了 ews-javascript-api 库。 (有ews-js-api-browser在浏览器中使用)

这样可以很容易地加载与项目相关的信息。

const loadedItem = await exch.BindToItems(
      [new ewsjs.ItemId(Office.context.mailbox.item.itemId)],
      new ewsjs.PropertySet(
        ewsjs.BasePropertySet.FirstClassProperties,
        ewsjs.EmailMessageSchema.Size,
      ),
    )

如果您不想使用该库,则必须按照文档中的说明here 自己编写 EWS 请求。

这些属性不能直接通过加载项 API 获得。您可以使用 makeEwsRequestAsync API to make a call to the Exchange backend, and use the GetItem EWS Operation to get properties of the message. Modify the ItemShape 元素来指定您需要的属性。

请注意,您的加载项必须在其加载项清单中指定 ReadWriteMailbox 权限。