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。 |