在Outlook邮件中发送邮件后,itemId发生了变化 [英] itemId is changing after mail sent in outlook mail

查看:275
本文介绍了在Outlook邮件中发送邮件后,itemId发生了变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在撰写模式下,在saveAsync之后我收到邮件项目的itemId.

I am getting itemId of a mail item after saveAsync in compose mode.

发送邮件项目后,Office.context.mailbox.item.itemId中的项目Id与在撰写模式下给出的项目不同.

Once mail item is sent, item Id coming in Office.context.mailbox.item.itemId is different than what is given in compose mode.

用于在撰写模式下获取itemId的代码:

Code used for getting itemId in compose mode:

var itemId = Office.context.mailbox.item.itemId;
if (itemId === null || itemId == undefined) {
    Office.context.mailbox.item.saveAsync(function (result) {
        itemId = result.value;
    });
}

发送电子邮件后,我使用以下命令从发件箱中验证了电子邮件的itemId:

After the email is sent, I verified email's itemId from sent box using:

`Office.context.mailbox.item.itemId`

令我惊讶的是,情况有所不同.

to my surprise it is different.

根据

itemId属性在撰写模式下不可用.如果需要商品标识符,则可以使用saveAsync方法将商品保存到商店,这将在回调函数的AsyncResult.value参数中返回商品标识符.

The itemId property is not available in compose mode. If an item identifier is required, the saveAsync method can be used to save the item to the store, which will return the item identifier in the AsyncResult.value parameter in the callback function.

我做错了什么?

推荐答案

首先,重要的是要了解项目的itemId不是静态值.每当在Exchange中移动项目时,ID都会更改.来自 EWS文档:

First it is important to understand that an item's itemId is not a static value. The ID will change whenever an item is moved around in Exchange. From the EWS documentation:

Exchange中的标识符是不透明的.例如,EwsId是从几条信息中创建的,这些信息对您(作为开发人员)并不重要,但对Exchange却很重要.

Identifiers in Exchange are opaque. For example, the EwsId is created from several pieces of information that are not important to you as the developer, but are important to Exchange.

为什么会发生这种情况,这是因为saveAsync会将电子邮件保存到草稿"文件夹中.发送后,该项目首先移至发件箱",然后移至已发送邮件"文件夹.这些文件夹更改(草稿,发件箱和已发送邮件)中的每一个都会导致对itemId字段的更改.

As to why this is happening, it is because saveAsync will result in the email being saved to the Drafts folder. When it is sent the item first moved to the Outbox and then into the Sent Items folder. Each of those folder changes (Drafts, Outbox, and Sent Items) results in a change to the itemId field.

这篇关于在Outlook邮件中发送邮件后,itemId发生了变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆