AccountsApp

這是多帳戶指令碼中使用的最上層物件,用來取得使用者有權存取的帳戶清單,以及選取要管理的帳戶。 取得帳戶之後,請使用 AdsApp 物件存取其實體。

此物件適用於從 Microsoft Advertising Web 應用程式中的帳戶 摘要 存取的指令碼編輯器執行的指令碼。

方法

方法名稱 傳回類型 描述
帳戶 BingAdsAccountSelector 取得 選取器 ,用來篩選使用者可存取的帳戶清單。
選取 (BingAdsAccount 帳戶) void 選取要在指令碼中處理的帳戶。

帳戶

取得 選取器 ,用來篩選使用者可存取的帳戶清單。

傳回

類型 描述
BingAdsAccountSelector 用來篩選使用者有權存取的帳戶清單的選取器。

選取 (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。

另請參閱

多帳戶存取