Office.PhoneNumber interface

表示项目中标识的电话号码。 仅限阅读模式。

在对所选项目调用 getEntities 方法时,将在 对象的 属性EntitiesphoneNumbers返回包含电子邮件中找到的电话号码的对象数组PhoneNumber

注解

最低权限级别读取项

适用的 Outlook 模式:读取

重要提示:基于实体的上下文 Outlook 加载项将在 2024 年第 2 季度停用。 停用此功能的工作将于 5 月开始,并持续到 6 月底。 6 月之后,上下文加载项将无法再检测邮件项目中的实体以对其执行任务。 以下 API 也将停用。

  • Office.context.mailbox.item.getEntities - Office.context.mailbox.item.getEntitiesByType - Office.context.mailbox.item.getFilteredEntitiesByName - Office.context.mailbox.item.getSelectedEntities

为了帮助最大程度地减少潜在的中断,在基于实体的上下文加载项停用后,仍支持以下内容。

  • 正在开发由联机会议加载项激活的 “加入 会议”按钮的替代实现。 结束对基于实体的上下文加载项的支持后,联机会议加载项将自动转换为替代实现,以激活“ 加入会议 ”按钮。

  • 基于实体的上下文加载项停用后,将继续支持正则表达式规则。 建议更新上下文加载项,以使用正则表达式规则作为替代解决方案。 有关如何实现这些规则的指南,请参阅 使用正则表达式激活规则显示 Outlook 加载项

有关详细信息,请参阅 基于实体的上下文 Outlook 加载项的停用。

示例

const item = Office.context.mailbox.item;
// Get an array of strings that represent phone numbers in the current item's body.
const phoneNumbers = item.getEntitiesByType(Office.MailboxEnums.EntityType.PhoneNumber);
console.log("There are " + phoneNumbers.length + " phone numbers.")
phoneNumbers.forEach(function (phoneNumber) {
    console.log("Phone number: " + JSON.stringify(phoneNumber.phoneString));
    console.log("Type: " + JSON.stringify(phoneNumber.type));
    console.log("Source text: " + JSON.stringify(phoneNumber.originalPhoneString));
});

属性

originalPhoneString

获取在项中识别为电话号码的文本。

phoneString

获取包含电话号码的字符串。 该字符串只包含电话号码中的数字,而不包括原始项目中存在的括号和连字符等字符。

type

获取标识电话号码类型的字符串:家庭、工作、移动、未指定。

属性详细信息

originalPhoneString

获取在项中识别为电话号码的文本。

originalPhoneString: string;

属性值

string

phoneString

获取包含电话号码的字符串。 该字符串只包含电话号码中的数字,而不包括原始项目中存在的括号和连字符等字符。

phoneString: string;

属性值

string

type

获取标识电话号码类型的字符串:家庭、工作、移动、未指定。

type: string;

属性值

string