title: Google Adwords API C# Client Library
body: <p>I downloaded the Adwords API client library for DOTNET. I am trying to use the GetAccountHierarchy.cs file example to get the account client list from Adwords Account. The code is appended as below:</p>
  
  <pre><code>using Google.Api.Ads.AdWords.Lib;
  using Google.Api.Ads.AdWords.v201209;
  
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Text;
  
  namespace Google.Api.Ads.AdWords.Examples.CSharp.v201209 {
    /// &lt;summary&gt;
    /// This code example illustrates how to retrieve the account hierarchy under
    /// an account. This code example won't work with Test Accounts. See
    /// https://developers.google.com/adwords/api/docs/test-accounts
    ///
    /// Tags: ManagedCustomerService.get
    /// &lt;/summary&gt;
    public class GetAccountHierarchy : ExampleBase {
      /// &lt;summary&gt;
      /// Main method, to run this code example as a standalone application.
      /// &lt;/summary&gt;
      /// &lt;param name="args"&gt;The command line arguments.&lt;/param&gt;
      public static void Main(string[] args) {
        GetAccountHierarchy codeExample = new GetAccountHierarchy();
        Console.WriteLine(codeExample.Description);
        try {
          codeExample.Run(new AdWordsUser());
        } catch (Exception ex) {
          Console.WriteLine("An exception occurred while running this code example. {0}",
              ExampleUtilities.FormatException(ex));
        }
      }
  
      /// &lt;summary&gt;
      /// Returns a description about the code example.
      /// &lt;/summary&gt;
      public override string Description {
        get {
          return "This code example illustrates how to retrieve the account hierarchy under" +
              " an account. This code example won't work with Test Accounts. See " +
              "https://developers.google.com/adwords/api/docs/test-accounts";
        }
      }
  
      /// &lt;summary&gt;
      /// Runs the code example.
      /// &lt;/summary&gt;
      /// &lt;param name="user"&gt;The AdWords user.&lt;/param&gt;
      public void Run(AdWordsUser user) {
        // Get the ManagedCustomerService.
        ManagedCustomerService managedCustomerService = (ManagedCustomerService) user.GetService(
            AdWordsService.v201209.ManagedCustomerService);
        managedCustomerService.RequestHeader.clientCustomerId = null;
  
        // Create selector.
        Selector selector = new Selector();
        selector.fields = new String[] {"Login", "CustomerId", "Name"};
  
        try {
          // Get results.
          ManagedCustomerPage page = managedCustomerService.get(selector);
  
          // Display serviced account graph.
          if (page.entries != null) {
            // Create map from customerId to customer node.
            Dictionary&lt;long, ManagedCustomerTreeNode&gt; customerIdToCustomerNode =
                new Dictionary&lt;long, ManagedCustomerTreeNode&gt;();
  
            // Create account tree nodes for each customer.
            foreach (ManagedCustomer customer in page.entries) {
              ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
              node.Account = customer;
              customerIdToCustomerNode.Add(customer.customerId, node);
            }
  
            // For each link, connect nodes in tree.
            if (page.links != null) {
              foreach (ManagedCustomerLink link in page.links) {
                ManagedCustomerTreeNode managerNode =
                    customerIdToCustomerNode[link.managerCustomerId];
                ManagedCustomerTreeNode childNode = customerIdToCustomerNode[link.clientCustomerId];
                childNode.ParentNode = managerNode;
                if (managerNode != null) {
                  managerNode.ChildAccounts.Add(childNode);
                }
              }
            }
  
            // Find the root account node in the tree.
            ManagedCustomerTreeNode rootNode = null;
            foreach (ManagedCustomer account in page.entries) {
              if (customerIdToCustomerNode[account.customerId].ParentNode == null) {
                rootNode = customerIdToCustomerNode[account.customerId];
                break;
              }
            }
  
            // Display account tree.
            Console.WriteLine("Login, CustomerId, Name");
            Console.WriteLine(rootNode.ToTreeString(0, new StringBuilder()));
          } else {
            Console.WriteLine("No serviced accounts were found.");
          }
        } catch (Exception ex) {
          throw new System.ApplicationException("Failed to create ad groups.", ex);
        }
      }
  
      /**
       * Example implementation of a node that would exist in an account tree.
       */
      class ManagedCustomerTreeNode {
        /// &lt;summary&gt;
        /// The parent node.
        /// &lt;/summary&gt;
        private ManagedCustomerTreeNode parentNode;
  
        /// &lt;summary&gt;
        /// The account associated with this node.
        /// &lt;/summary&gt;
        private ManagedCustomer account;
  
        /// &lt;summary&gt;
        /// The list of child accounts.
        /// &lt;/summary&gt;
        private List&lt;ManagedCustomerTreeNode&gt; childAccounts = new List&lt;ManagedCustomerTreeNode&gt;();
  
        /// &lt;summary&gt;
        /// Gets or sets the parent node.
        /// &lt;/summary&gt;
        public ManagedCustomerTreeNode ParentNode {
          get { return parentNode; }
          set { parentNode = value; }
        }
  
        /// &lt;summary&gt;
        /// Gets or sets the account.
        /// &lt;/summary&gt;
        public ManagedCustomer Account {
          get { return account; }
          set { account = value; }
        }
  
        /// &lt;summary&gt;
        /// Gets the child accounts.
        /// &lt;/summary&gt;
        public List&lt;ManagedCustomerTreeNode&gt; ChildAccounts {
          get { return childAccounts; }
        }
  
        /// &lt;summary&gt;
        /// Returns a &lt;see cref="System.String"/&gt; that represents this instance.
        /// &lt;/summary&gt;
        /// &lt;returns&gt;
        /// A &lt;see cref="System.String"/&gt; that represents this instance.
        /// &lt;/returns&gt;
        public override String ToString() {
          String login = String.IsNullOrEmpty(account.login) ? "(no login)" : account.login;
          return String.Format("{0}, {1}, {2}", login, account.customerId, account.name);
        }
  
        /// &lt;summary&gt;
        /// Returns a string representation of the current level of the tree and
        /// recursively returns the string representation of the levels below it.
        /// &lt;/summary&gt;
        /// &lt;param name="depth"&gt;The depth of the node.&lt;/param&gt;
        /// &lt;param name="sb"&gt;The String Builder containing the tree
        /// representation.&lt;/param&gt;
        /// &lt;returns&gt;The tree string representation.&lt;/returns&gt;
        public StringBuilder ToTreeString(int depth, StringBuilder sb) {
          sb.Append(new String('-', depth * 2));
          sb.Append(this);
          sb.Append("\n");
          foreach (ManagedCustomerTreeNode childAccount in childAccounts) {
            childAccount.ToTreeString(depth + 1, sb);
          }
          return sb;
        }
      }
    }
  }
  </code></pre>
  
  <p>I am trying to figure out where i can pass the parameter like my account username, password, developer token and access token to this function? Does anybody know how i can pass those info to this code? Thanks.</p>