次の方法で共有


AccountsApp

これは、ユーザーがアクセスできるアカウントの一覧を取得し、管理するアカウントを選択するために、マルチアカウント スクリプトで使用される最上位のオブジェクトです。 アカウントを取得したら、 AdsApp オブジェクトを使用してそのエンティティにアクセスします。

このオブジェクトは、Microsoft Advertising Web アプリケーションの [アカウントの概要] からアクセスしたスクリプト エディターから実行されるスクリプトで使用できます。

メソッド

メソッド名 戻り値の型 説明
アカウント BingAdsAccountSelector ユーザーがアクセスできるアカウントの一覧をフィルター処理するために使用する セレクター を取得します。
select(BingAdsAccount アカウント) void スクリプトで処理するアカウントを選択します。

アカウント

ユーザーがアクセスできるアカウントの一覧をフィルター処理するために使用する セレクター を取得します。

戻り値

説明
BingAdsAccountSelector ユーザーがアクセスできるアカウントの一覧をフィルター処理するために使用されるセレクター。

select(BingAdsAccount アカウント)

スクリプトで処理するアカウントを選択します。

次の例は、スクリプトが別のアカウントで処理している現在のアカウントを変更する方法を示しています。

    // Get the account that the script is currently processing.
    var oldAccount = AdsApp.currentAccount();

    // Get another account that the user manages.
    var newAccount = AccountsApp.accounts()
        .withIds(["123456789"])
        .get()
        .next();

    // Make the new account the current account that the script processes.
    AccountsApp.select(newAccount);

    // Do something with the new account

    // Change the current account back to the old account
    AccountsApp.select(oldAccount);

引数

名前 説明
アカウント BingAdsAccount スクリプトで処理するアカウント。

戻り値

説明
void Nothing を返します。

関連項目

マルチアカウント アクセス