Example #1
0
    /// <summary>
    /// Downloads all sandbox client accounts under an mcc. This function
    /// internally uses <see cref="DownloadAccount"/> to download each client
    /// returned by getClientAccounts method of AccountService.
    /// </summary>
    /// <returns>An array of ClientAccount objects.</returns>
    public LocalClientAccount[] DownloadAllAccounts(string[] campaignFields, string[] adGroupFields,
        string[] adFields, string[] criterionFields, string[] campaignCriterionFields) {
      // Get the ServicedAccountService.
      ServicedAccountService servicedAccountService =
          (ServicedAccountService) user.GetService(AdWordsService.v201109.
              ServicedAccountService);

      ServicedAccountSelector selector = new ServicedAccountSelector();
      selector.enablePaging = false;

      ServicedAccountGraph graph = servicedAccountService.get(selector);

      List<LocalClientAccount> allClients = new List<LocalClientAccount>();

      if (graph != null && graph.accounts != null) {
        for (int i = 0; i < graph.accounts.Length; i++) {
          allClients.Add(DownloadAccount(graph.accounts[i].customerId, campaignFields,
              adGroupFields, adFields, criterionFields, campaignCriterionFields));
        }
      }
      return allClients.ToArray();
    }
Example #2
0
 public virtual ServicedAccountGraph get(ServicedAccountSelector selector) {
   object[] results = this.Invoke("get", new object[] {selector});
   return ((ServicedAccountGraph) (results[0]));
 }