Ejemplo n.º 1
0
        /// <summary>
        /// Main method, to run this code example as a standalone application.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        public static void Main(string[] args)
        {
            AddGoogleMyBusinessLocationExtensions codeExample =
                new AddGoogleMyBusinessLocationExtensions();

            Console.WriteLine(codeExample.Description);

            AdWordsUser user = new AdWordsUser();

            try {
                // The email address of either an owner or a manager of the GMB account.
                string gmbEmailAddress = "INSERT_GMB_EMAIL_ADDRESS_HERE";

                // Refresh the access token so that there's a valid access token.
                user.OAuthProvider.RefreshAccessToken();

                // If the gmbEmailAddress above is the same user you used to generate
                // your AdWords API refresh token, leave the assignment below unchanged.
                // Otherwise, to obtain an access token for your GMB account, run the
                // OAuth Token generator utility while logged in as the same user as
                // gmbEmailAddress. Copy and paste the AccessToken value into the
                // assignment below.
                string gmbAccessToken = user.OAuthProvider.AccessToken;

                // If the gmbEmailAddress above is for a GMB manager instead of the GMB
                // account owner, then set businessAccountIdentifier to the +Page ID of
                // a location for which the manager has access. See the location
                // extensions guide at
                // https://developers.google.com/adwords/api/docs/guides/feed-services-locations
                // for details.
                String businessAccountIdentifier = null;
                codeExample.Run(user, gmbEmailAddress, gmbAccessToken, businessAccountIdentifier);
            } catch (Exception e) {
                Console.WriteLine("An exception occurred while running this code example. {0}",
                                  ExampleUtilities.FormatException(e));
            }
        }
        /// <summary>
        /// Main method, to run this code example as a standalone application.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        public static void Main(string[] args)
        {
            AddGoogleMyBusinessLocationExtensions codeExample =
              new AddGoogleMyBusinessLocationExtensions();
              Console.WriteLine(codeExample.Description);

              AdWordsUser user = new AdWordsUser();

              try {
            // The email address of either an owner or a manager of the GMB account.
            string gmbEmailAddress = "INSERT_GMB_EMAIL_ADDRESS_HERE";

            // Refresh the access token so that there's a valid access token.
            user.OAuthProvider.RefreshAccessToken();

            // If the gmbEmailAddress above is the same user you used to generate
            // your AdWords API refresh token, leave the assignment below unchanged.
            // Otherwise, to obtain an access token for your GMB account, run the
            // OAuth Token generator utility while logged in as the same user as
            // gmbEmailAddress. Copy and paste the AccessToken value into the
            // assignment below.
            string gmbAccessToken = user.OAuthProvider.AccessToken;

            // If the gmbEmailAddress above is for a GMB manager instead of the GMB
            // account owner, then set businessAccountIdentifier to the +Page ID of
            // a location for which the manager has access. See the location
            // extensions guide at
            // https://developers.google.com/adwords/api/docs/guides/feed-services-locations
            // for details.
            String businessAccountIdentifier = null;
            codeExample.Run(user, gmbEmailAddress, gmbAccessToken, businessAccountIdentifier);
              } catch (Exception e) {
            Console.WriteLine("An exception occurred while running this code example. {0}",
            ExampleUtilities.FormatException(e));
              }
        }