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 | 不返回任何内容。 |