Office.Diagnostics interface
将诊断信息提供给 Outlook 外接程序。
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取
从邮箱要求集 1.5 开始,还可以使用 Office.context.诊断 属性获取类似信息。
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-diagnostic-information.yaml
// This function gets a mailbox's diagnostic information, such as Outlook client and version, and logs it to the console.
const diagnostics = Office.context.mailbox.diagnostics;
console.log(`Client application: ${diagnostics.hostName}`);
console.log(`Client version: ${diagnostics.hostVersion}`);
switch (diagnostics.OWAView) {
case undefined:
console.log("Current view (Outlook on the web only): Not applicable. An Outlook desktop client is in use.");
break;
case Office.MailboxEnums.OWAView.OneColumnNarrow:
console.log("Current view (Outlook on the web only): Viewed from an older generation mobile phone");
break;
case Office.MailboxEnums.OWAView.OneColumn:
console.log("Current view (Outlook on the web only): Viewed from a newer generation mobile phone");
break;
case Office.MailboxEnums.OWAView.TwoColumns:
console.log("Current view (Outlook on the web only): Viewed from a tablet");
break;
case Office.MailboxEnums.OWAView.ThreeColumns:
console.log("Current view (Outlook on the web only): Viewed from a desktop computer");
break;
}
属性
| ews | 获取一个 对象,用于标识组织中是否支持 Exchange Web Services (EWS) 回调令牌。 |
| host |
获取表示 Outlook 客户端类型的字符串。 字符串可以是以下值之一: |
| host |
获取表示 Outlook 客户端或Exchange Server (版本(例如“15.0.468.0”) )的字符串。 如果邮件加载项在 Outlook on Windows (经典) 、Mac 或移动设备中运行,则 |
| OWAView | 获取表示Outlook 网页版的当前视图的字符串。 返回的字符串可以是以下值之一: 如果未Outlook 网页版应用程序,则访问此属性会导致未定义。 Outlook 网页版有三个视图,对应于屏幕和窗口的宽度以及可显示的列数:
|
属性详细信息
ews
注意
此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。
获取一个 对象,用于标识组织中是否支持 Exchange Web Services (EWS) 回调令牌。
ews: Ews;
属性值
注解
[ API 集:邮箱预览 ]
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取
重要说明:
属性
ews在 Outlook 网页版 和 Windows (新版和经典版 (版本 2510、内部版本 19328.20000 及更高版本) ) 中提供预览版。旧Exchange Online用户标识令牌和回调令牌不再受支持,所有Microsoft 365 个租户中都处于关闭状态。 如果 Outlook 外接程序需要委派的用户访问或用户标识,我们建议使用 MSAL (Microsoft 身份验证库) 和嵌套应用身份验证 (NAA) 。 本地 Exchange 仍支持 Exchange 用户标识令牌。 有关详细信息,请参阅 嵌套应用身份验证常见问题解答。
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-token-status.yaml
Office.context.mailbox.diagnostics.ews.getTokenStatusAsync({ isRest: false }, (result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.log(result.error.message);
return;
}
const status = result.value;
switch (status) {
case Office.MailboxEnums.TokenStatus.Enabled:
console.log("EWS callback tokens are enabled.");
break;
case Office.MailboxEnums.TokenStatus.Disabled:
console.log("EWS callback tokens are disabled.");
break;
case Office.MailboxEnums.TokenStatus.Removed:
console.log(
"The organization has an Exchange Online environment. Legacy Exchange tokens are no longer supported.",
);
break;
}
});
hostName
获取表示 Outlook 客户端类型的字符串。
字符串可以是以下值之一:Outlook、newOutlookWindows、OutlookWebApp、 OutlookIOS或 。OutlookAndroid
hostName: string;
属性值
string
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取
重要提示:在 Outlook Windows (经典) 和 Mac 上返回 Outlook 的值。
newOutlookWindows 为 Windows 上的新 Outlook 返回 。
hostVersion
获取表示 Outlook 客户端或Exchange Server (版本(例如“15.0.468.0”) )的字符串。
如果邮件加载项在 Outlook on Windows (经典) 、Mac 或移动设备中运行,则 hostVersion 属性将返回 Outlook 客户端的版本。 在 Outlook 网页版 和新的 Outlook on Windows 中, 属性返回Exchange Server的版本。
hostVersion: string;
属性值
string
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取
OWAView
获取表示Outlook 网页版的当前视图的字符串。
返回的字符串可以是以下值之一: OneColumn、 TwoColumns或 ThreeColumns。
如果未Outlook 网页版应用程序,则访问此属性会导致未定义。
Outlook 网页版有三个视图,对应于屏幕和窗口的宽度以及可显示的列数:
OneColumn,在屏幕较窄时显示。 Outlook 网页版在智能手机的整个屏幕上使用此单列布局。TwoColumns,在屏幕较宽时显示。 Outlook 网页版在大多数平板电脑上使用此视图。ThreeColumns,在屏幕较宽时显示。 例如,Outlook 网页版在台式计算机上的全屏窗口中使用此视图。
OWAView: MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns";
属性值
Office.MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns"
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取