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;
}
if (Office.context.requirements.isSetSupported("Mailbox", "1.16")) {
const ewsTokenStatus = diagnostics.ews;
ewsTokenStatus.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 token status: EWS callback tokens are enabled.");
break;
case Office.MailboxEnums.TokenStatus.Disabled:
console.log("EWS token status: EWS callback tokens are disabled.");
break;
case Office.MailboxEnums.TokenStatus.Removed:
console.log("EWS token status: The organization has an Exchange Online environment. Legacy Exchange tokens are no longer supported.");
break;
}
});
}
プロパティ
| ews | オブジェクトを取得して、Exchange Web サービス (EWS) コールバック トークンがorganizationでサポートされているかどうかを識別します。 |
| host |
Outlook クライアントの種類を表す文字列を取得します。 文字列には、 |
| host |
Outlook クライアントまたは Exchange Server のバージョンを表す文字列を取得します (たとえば、"15.0.468.0")。 メール アドインが Windows (クラシック)、Mac、またはモバイル デバイスの Outlook で実行されている場合、 |
| OWAView | Outlook on the web の現在のビューを表す文字列を取得します。 返される文字列は、 アプリケーションが Outlook on the web ではない場合、このプロパティにアクセスすると undefined になります。 Outlook on the web には、画面とウィンドウの幅、および表示できる列数に対応する 3 つのビューがあります。
|
プロパティの詳細
ews
オブジェクトを取得して、Exchange Web サービス (EWS) コールバック トークンがorganizationでサポートされているかどうかを識別します。
ews: Ews;
プロパティ値
注釈
最小アクセス許可レベル: 項目の読み取り
適用可能な Outlook モード: Composeまたは読み取り
重要: 従来の Exchange Online ユーザー ID トークンとコールバック トークンはサポートされなくなり、すべての Microsoft 365 テナントでオフになっています。 Outlook アドインで代理ユーザー アクセスまたはユーザー ID が必要な場合は、MSAL (Microsoft 認証ライブラリ) と入れ子になったアプリ認証 (NAA) を使うことをお勧めします。 Exchange ユーザー ID トークンは、Exchange オンプレミスで引き続きサポートされます。 詳細については、「 入れ子になったアプリ認証に関する FAQ」を参照してください。
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/89-other-mailbox-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 は、 新しい Outlook on Windows で返されます。
hostVersion
Outlook クライアントまたは Exchange Server のバージョンを表す文字列を取得します (たとえば、"15.0.468.0")。
メール アドインが Windows (クラシック)、Mac、またはモバイル デバイスの Outlook で実行されている場合、 hostVersion プロパティは Outlook クライアントのバージョンを返します。
Outlook on the web および新しい Outlook on Windows では、プロパティはExchange Serverのバージョンを返します。
hostVersion: string;
プロパティ値
string
注釈
最小アクセス許可レベル: 項目の読み取り
適用可能な Outlook モード: Composeまたは読み取り
OWAView
Outlook on the web の現在のビューを表す文字列を取得します。
返される文字列は、 OneColumn、 TwoColumns、または ThreeColumns のいずれかの値を指定できます。
アプリケーションが Outlook on the web ではない場合、このプロパティにアクセスすると undefined になります。
Outlook on the web には、画面とウィンドウの幅、および表示できる列数に対応する 3 つのビューがあります。
OneColumnこれは、画面が狭い場合に表示されます。 Outlook on the web では、スマートフォンの画面全体でこの 1 列のレイアウトが使用されます。TwoColumns画面が広い場合に表示されます。 Outlook on the web では、ほとんどのタブレットでこのビューを使用します。ThreeColumns。これは、画面が広い場合に表示されます。 たとえば、Outlook on the web では、デスクトップ コンピューターの全画面表示ウィンドウでこのビューを使用します。
OWAView: MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns";
プロパティ値
Office.MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns"
注釈
最小アクセス許可レベル: 項目の読み取り
適用可能な Outlook モード: Composeまたは読み取り