OneNote.SectionGroup class

OneNote セクション グループを表します。 セクション グループに含めることができるのは、セクションとその他のセクション グループです。

Extends

注釈

[ API セット: OneNoteApi 1.1 ]

プロパティ

clientUrl

セクション グループのクライアント url です。 読み取りのみ

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

id

セクション グループの ID を取得します。 読み取り専用です。

name

セクション グループの名前を取得します。 読み取り専用です。

notebook

セクション グループを含むノートブックを取得します。 読み取り専用です。

parentSectionGroup

セクション グループを含むセクション グループを取得します。 セクション グループがノートブックの直接の子である場合は ItemNotFound をスローします。 読み取り専用です。

parentSectionGroupOrNull

セクション グループを含むセクション グループを取得します。 セクション グループがノートブックの直接の子である場合は null を返します。 読み取り専用です。

sectionGroups

セクション グループ内のセクション グループのコレクションです。 読み取りのみ

sections

セクション グループ内のセクションのコレクションです。 読み取りのみ

メソッド

addSection(title)

セクション グループの末尾に新しいセクションを追加します。

addSectionGroup(name)

この sectionGroup の末尾に新しいセクション グループを追加します。

getRestApiId()

REST API ID を取得します。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の OneNote.SectionGroup オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として OneNote.Interfaces.SectionGroupData型指定) を返します。

track()

ドキュメントの環境変更に基づいて自動的に調整する目的でオブジェクトを追跡します。 この呼び出しは の短縮形です context.trackedObjects.add(thisObject)。 このオブジェクトを呼び出しで .sync 使用し、".run" バッチのシーケンシャル実行の外部で使用していて、プロパティを設定するとき、またはオブジェクトのメソッドを呼び出すときに "InvalidObjectPath" エラーが発生する場合は、オブジェクトが最初に作成されたときに、追跡対象のオブジェクト コレクションにオブジェクトを追加する必要があります。

untrack()

前に追跡されていた場合、このオブジェクトに関連付けられているメモリを解放します。 この呼び出しは の context.trackedObjects.remove(thisObject)短縮形です。 追跡対象オブジェクトが多いとホスト アプリケーションの動作が遅くなります。追加したオブジェクトが不要になったら、必ずそれを解放してください。 メモリ解放が有効になる前に を呼び出す context.sync() 必要があります。

プロパティの詳細

clientUrl

セクション グループのクライアント url です。 読み取りのみ

readonly clientUrl: string;

プロパティ値

string

注釈

[ API セット: OneNoteApi 1.1 ]

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

id

セクション グループの ID を取得します。 読み取り専用です。

readonly id: string;

プロパティ値

string

注釈

[ API セット: OneNoteApi 1.1 ]

name

セクション グループの名前を取得します。 読み取り専用です。

readonly name: string;

プロパティ値

string

注釈

[ API セット: OneNoteApi 1.1 ]

notebook

セクション グループを含むノートブックを取得します。 読み取り専用です。

readonly notebook: OneNote.Notebook;

プロパティ値

注釈

[ API セット: OneNoteApi 1.1 ]

parentSectionGroup

セクション グループを含むセクション グループを取得します。 セクション グループがノートブックの直接の子である場合は ItemNotFound をスローします。 読み取り専用です。

readonly parentSectionGroup: OneNote.SectionGroup;

プロパティ値

注釈

[ API セット: OneNoteApi 1.1 ]

parentSectionGroupOrNull

セクション グループを含むセクション グループを取得します。 セクション グループがノートブックの直接の子である場合は null を返します。 読み取り専用です。

readonly parentSectionGroupOrNull: OneNote.SectionGroup;

プロパティ値

注釈

[ API セット: OneNoteApi 1.1 ]

sectionGroups

セクション グループ内のセクション グループのコレクションです。 読み取りのみ

readonly sectionGroups: OneNote.SectionGroupCollection;

プロパティ値

注釈

[ API セット: OneNoteApi 1.1 ]

sections

セクション グループ内のセクションのコレクションです。 読み取りのみ

readonly sections: OneNote.SectionCollection;

プロパティ値

注釈

[ API セット: OneNoteApi 1.1 ]

メソッドの詳細

addSection(title)

セクション グループの末尾に新しいセクションを追加します。

addSection(title: string): OneNote.Section;

パラメーター

title

string

新しいセクションの名前を指定します。

戻り値

注釈

[ API セット: OneNoteApi 1.1 ]

await OneNote.run(async (context) => {

    // Get the section groups that are direct children of the current notebook.
    const sectionGroups = context.application.getActiveNotebook().sectionGroups;
    
    // Queue a command to load the section groups.
    // For best performance, request specific properties.
    sectionGroups.load("id");

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();
            
    // Add a section to each section group.
    $.each(sectionGroups.items, function(index, sectionGroup) {
        sectionGroup.addSection("Agenda");
    });
    
    // Run the queued commands.
    await context.sync();
});

addSectionGroup(name)

この sectionGroup の末尾に新しいセクション グループを追加します。

addSectionGroup(name: string): OneNote.SectionGroup;

パラメーター

name

string

新しいセクションの名前を指定します。

戻り値

注釈

[ API セット: OneNoteApi 1.1 ]

await OneNote.run(async (context) => {
    let sectionGroup;
    let nestedSectionGroup;

    // Gets the active notebook.
    const notebook = context.application.getActiveNotebook();

    // Queue a command to add a new section group.
    const sectionGroups = notebook.sectionGroups;

    // Queue a command to load the new section group.
    sectionGroups.load();

    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();

    sectionGroup = sectionGroups.items[0];
    sectionGroup.load();
    await context.sync();

    nestedSectionGroup = sectionGroup.addSectionGroup("Sample nested section group");
    nestedSectionGroup.load();
    await context.sync();
    
    console.log("New nested section group name is " + nestedSectionGroup.name);
});

getRestApiId()

REST API ID を取得します。

getRestApiId(): OfficeExtension.ClientResult<string>;

戻り値

注釈

[ API セット: OneNoteApi 1.1 ]

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: OneNote.Interfaces.SectionGroupLoadOptions): OneNote.SectionGroup;

パラメーター

options
OneNote.Interfaces.SectionGroupLoadOptions

読み込むオブジェクトのプロパティのオプションを提供します。

戻り値

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames?: string | string[]): OneNote.SectionGroup;

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切り文字列または文字列の配列。

戻り値

await OneNote.run(async (context) => {
        
    // Get the parent section group that contains the current section.
    const sectionGroup = context.application.getActiveSection().parentSectionGroup;
            
    // Queue a command to load the section group.
    // For best performance, request specific properties.
    sectionGroup.load("id,name");
            
    // Run the queued commands, and return a promise to indicate task completion.
    await context.sync();
            
    // Write the properties.
    console.log("Section group name: " + sectionGroup.name);
    console.log("Section group ID: " + sectionGroup.id);
});

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): OneNote.SectionGroup;

パラメーター

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select は、読み込むプロパティを指定するコンマ区切り文字列で propertyNamesAndPaths.expand 、読み込むナビゲーション プロパティを指定するコンマ区切りの文字列です。

戻り値

toJSON()

API オブジェクトが に渡されたときにより便利な出力を提供するために、JavaScript toJSON() メソッドを JSON.stringify()オーバーライドします。 (JSON.stringifyさらに、渡される オブジェクトの メソッドを呼び出 toJSON します)。元の OneNote.SectionGroup オブジェクトは API オブジェクトですが、メソッドは、元の toJSON オブジェクトから読み込まれた子プロパティの浅いコピーを含むプレーンな JavaScript オブジェクト (として OneNote.Interfaces.SectionGroupData型指定) を返します。

toJSON(): OneNote.Interfaces.SectionGroupData;

戻り値

track()

ドキュメントの環境変更に基づいて自動的に調整する目的でオブジェクトを追跡します。 この呼び出しは の短縮形です context.trackedObjects.add(thisObject)。 このオブジェクトを呼び出しで .sync 使用し、".run" バッチのシーケンシャル実行の外部で使用していて、プロパティを設定するとき、またはオブジェクトのメソッドを呼び出すときに "InvalidObjectPath" エラーが発生する場合は、オブジェクトが最初に作成されたときに、追跡対象のオブジェクト コレクションにオブジェクトを追加する必要があります。

track(): OneNote.SectionGroup;

戻り値

untrack()

前に追跡されていた場合、このオブジェクトに関連付けられているメモリを解放します。 この呼び出しは の context.trackedObjects.remove(thisObject)短縮形です。 追跡対象オブジェクトが多いとホスト アプリケーションの動作が遅くなります。追加したオブジェクトが不要になったら、必ずそれを解放してください。 メモリ解放が有効になる前に を呼び出す context.sync() 必要があります。

untrack(): OneNote.SectionGroup;

戻り値