Ads API .NET library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Google.Api.Ads.AdManager.Examples.CSharp.OAuth.ConsoleExample Class Reference

This code example shows how to run an Ad Manager API command line application while incorporating the OAuth2 installed application flow into your application. If your application uses a single Google login to make calls to all your accounts, you shouldn't use this code example. Instead, you should run Common\Util\OAuth2TokenGenerator.cs to generate a refresh token and set that in user.Config.OAuth2RefreshToken field, or set OAuth2RefreshToken key in your App.config / Web.config. More...

Detailed Description

This code example shows how to run an Ad Manager API command line application while incorporating the OAuth2 installed application flow into your application. If your application uses a single Google login to make calls to all your accounts, you shouldn't use this code example. Instead, you should run Common\Util\OAuth2TokenGenerator.cs to generate a refresh token and set that in user.Config.OAuth2RefreshToken field, or set OAuth2RefreshToken key in your App.config / Web.config.

This code example depends on Console environment only for reading and writing values, you may use this code example in other environments like Windows Form applications with minimial modifications.

To run this application,

  1. You should create a new Console Application project.
  2. Add references to the following:
    • Google.Ads.Common
    • Google.Dfp
    • System.Web
    • System.Configuration
  3. Replace the Main() method with this class's method.
  4. Copy App.config from AdManager.Examples project, and configure it as shown in this project's Web.config.
  5. Compile and run this example.

The documentation for this class was generated from the following file: