public void Run(GoogleAdsClient client, long customerId)
{
// Get the GoogleAdsService.
GoogleAdsServiceClient googleAdsService = client.GetService(Services.V1.GoogleAdsService);
// Create a request that will retrieve all campaigns using pages of the specified
// page size.
SearchGoogleAdsRequest request = new SearchGoogleAdsRequest()
{
PageSize = PAGE_SIZE,
Query = @"SELECT
campaign.network_settings.target_content_network
FROM campaign
CustomerId = customerId.ToString()
};
try
{
// Issue the search request.
PagedEnumerable<SearchGoogleAdsResponse, GoogleAdsRow> searchPagedResponse =
googleAdsService.Search(request);
foreach (SearchGoogleAdsResponse response in searchPagedResponse.AsRawResponses())
{
Console.WriteLine(response.FieldMask.Paths);
foreach (GoogleAdsRow googleAdsRow in response.Results)
{
Console.WriteLine("Campaign with ID {0} and name '{1}' was found.",
}
}
// Iterate over all rows in all pages and prints the requested field values for the
// campaign in each row.
foreach (GoogleAdsRow googleAdsRow in searchPagedResponse)
{
Console.WriteLine("Campaign with ID {0} and name '{1}' was found.",
}
}
catch (GoogleAdsException e)
{
Console.WriteLine("Failure:");
Console.WriteLine($"Message: {e.Message}");
Console.WriteLine($"Failure: {e.Failure}");
Console.WriteLine($"Request ID: {e.RequestId}");
}
}