Share via


Office.Diagnostics interface

Outlook アドインに診断情報を提供します。

注釈

[ API セット: メールボックス 1.1 ]

最小アクセス許可レベル: アイテムの読み取り

適用できる Outlook モード: 新規作成または読み取り

メールボックス要件セット 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;
}

プロパティ

hostName

Outlook クライアントの種類を表す文字列を取得します。

文字列には、または のいずれかの値newOutlookWindowsOutlookOutlookWebAppOutlookIOSを指定できます。OutlookAndroid

hostVersion

Outlook クライアントまたはExchange Serverのバージョン ("15.0.468.0" など) を表す文字列を取得します。

デスクトップまたはモバイル クライアントで Outlook でメール アドインが実行されている場合、 hostVersion プロパティは Outlook クライアントのバージョンを返します。 Outlook on the webでは、 プロパティはExchange Serverのバージョンを返します。

OWAView

Outlook on the webの現在のビューを表す文字列を取得します。

返される文字列には、または ThreeColumnsのいずれかの値OneColumnTwoColumnsを指定できます。

アプリケーションがOutlook on the webされていない場合、このプロパティにアクセスすると未定義になります。

Outlook on the webには、画面とウィンドウの幅と表示できる列の数に対応する 3 つのビューがあります。

  • OneColumnは、画面が狭いときに表示されます。 Outlook on the webは、スマートフォンの画面全体でこの単一列レイアウトを使用します。

  • TwoColumnsは、画面の幅が広いときに表示されます。 Outlook on the webは、ほとんどのタブレットでこのビューを使用します。

  • ThreeColumnsは、画面が広いときに表示されます。 たとえば、Outlook on the webはデスクトップ コンピューターの全画面表示ウィンドウでこのビューを使用します。

プロパティの詳細

hostName

Outlook クライアントの種類を表す文字列を取得します。

文字列には、または のいずれかの値newOutlookWindowsOutlookOutlookWebAppOutlookIOSを指定できます。OutlookAndroid

hostName: string;

プロパティ値

string

注釈

[ API セット: メールボックス 1.1 ]

最小アクセス許可レベル: アイテムの読み取り

適用できる Outlook モード: 新規作成または読み取り

重要: この値は Outlook 、Windows と Mac の Outlook デスクトップ クライアントに対して返されます。 newOutlookWindows は、現在プレビュー中の 新しい Outlook on Windows デスクトップ クライアント に対して返されます。

hostVersion

Outlook クライアントまたはExchange Serverのバージョン ("15.0.468.0" など) を表す文字列を取得します。

デスクトップまたはモバイル クライアントで Outlook でメール アドインが実行されている場合、 hostVersion プロパティは Outlook クライアントのバージョンを返します。 Outlook on the webでは、 プロパティはExchange Serverのバージョンを返します。

hostVersion: string;

プロパティ値

string

注釈

[ API セット: メールボックス 1.1 ]

最小アクセス許可レベル: アイテムの読み取り

適用できる Outlook モード: 新規作成または読み取り

OWAView

Outlook on the webの現在のビューを表す文字列を取得します。

返される文字列には、または ThreeColumnsのいずれかの値OneColumnTwoColumnsを指定できます。

アプリケーションがOutlook on the webされていない場合、このプロパティにアクセスすると未定義になります。

Outlook on the webには、画面とウィンドウの幅と表示できる列の数に対応する 3 つのビューがあります。

  • OneColumnは、画面が狭いときに表示されます。 Outlook on the webは、スマートフォンの画面全体でこの単一列レイアウトを使用します。

  • TwoColumnsは、画面の幅が広いときに表示されます。 Outlook on the webは、ほとんどのタブレットでこのビューを使用します。

  • ThreeColumnsは、画面が広いときに表示されます。 たとえば、Outlook on the webはデスクトップ コンピューターの全画面表示ウィンドウでこのビューを使用します。

OWAView: MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns";

プロパティ値

Office.MailboxEnums.OWAView | "OneColumn" | "TwoColumns" | "ThreeColumns"

注釈

[ API セット: メールボックス 1.1 ]

最小アクセス許可レベル: アイテムの読み取り

適用できる Outlook モード: 新規作成または読み取り