Hi All, 
 
I am using C# console app to get the Campaign records into text files. I 
got the developer token granted and approved. But when I run the below code 
,I see it is getting access but no records from GoogleAdwords. Any thought 
???  No Errors though !!! 
 
Below is my code 
 

AdWordsAppConfig config = user.Config as AdWordsAppConfig;

config.OAuth2Mode = OAuth2Flow.APPLICATION;

config.OAuth2ClientId = "XXXXXXX.apps.googleusercontent.com";

config.OAuth2ClientSecret = "SDSGDFGDFSGDFSGDFSGDSFGD";

config.DeveloperToken = "AAAAAAAAAAAAAAAAAAAAAAAA";

config.ClientCustomerId = "123-456-7890";

config.Email = "xxx...@gmail.com";

config.Password = "$#$#$#$";

config.OAuth2RefreshToken = "XXXXXXXXXXXDDDDDDDDDDDDSSSSSSSSn6zK6XiATCKT"; 

// Get the CampaignService.

 

CampaignService campaignService = (CampaignService)user.GetService(
AdWordsService.v201506.CampaignService);

// Create the selector.

Selector selector = new Selector();

selector.fields = new string[] { "Id", "Name" };

 

 

// Set the selector paging.

selector.paging = new Paging();

int offset = 0;

int pageSize = 500;

CampaignPage page = new CampaignPage();

try

{

do

{

selector.paging.startIndex = offset;

selector.paging.numberResults = pageSize;

// Get the campaigns.

page = campaignService.get(selector);

Console.WriteLine(page.totalNumEntries.ToString());

// Display the results.

if (page != null && page.entries != null)

{

int i = offset;

foreach (Campaign campaign in page.entries)

{

Console.WriteLine("{0}) Campaign with id = '{1}', name = '{2}' " +

" was found.", i + 1, campaign.id, campaign.name, campaign.status);

i++;

}

}

offset += pageSize;

} while (offset < page.totalNumEntries);

Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries);

}

catch (Exception ex)

{ 

Console.WriteLine( "Failed to retrieve campaigns"+ ex.Message.ToString() );

}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f6eefc32-0fd5-4b63-8a9a-d54705569bb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to