Team,
I am trying to get the Criteria data by using C# code. Below is my code to
get the data by paging, problem is on the Paging. Total Record count is
189,000 , i have them assigned to get 10,000 records per pull, when i get
into 100,000 as a startIndex , i get an error !!. Could you please assist
on this issue ? Thanks
try
{
// Check if the Client Customer ID has a value in it before
fetching the data
if(GAdWordsConfig.ClientCustomerId.Length >0)
{
// Get Critieia Service
CampaignCriterionService GAdWordsCampaignCriterionService =
(CampaignCriterionService)GAdWordsUser.GetService(AdWordsService.v201509.CampaignCriterionService);
// Create the selector.
Selector GAdWordsSelector = new Selector()
{
fields = new string[] {Criterion.Fields.Id,
Criterion.Fields.CriteriaType, CampaignCriterion.Fields.CampaignId},
predicates = new Predicate[] {
// Select only keywords.
Predicate.In(Criterion.Fields.CriteriaType,new string[]
{"KEYWORD", "PLACEMENT"}),},
paging = Paging.Default
};
CampaignCriterionPage GAdWordsPage = new
CampaignCriterionPage();
do
{
// Get the data from GoogleAdWords
GAdWordsPage =
GAdWordsCampaignCriterionService.get(GAdWordsSelector);
if (GAdWordsPage != null && GAdWordsPage.entries != null)
{
int i = GAdWordsSelector.paging.startIndex;
foreach (CampaignCriterion adCampaignCriterion in
GAdWordsPage.entries)
{
OutGAAdCriteriaBuffer.AddRow();
OutGAAdCriteriaBuffer.ClientCustomerID =
GAdWordsConfig.ClientCustomerId.ToString().Trim();
OutGAAdCriteriaBuffer.AdCriteriaID =
adCampaignCriterion.criterion.id.ToString().Trim();
OutGAAdCriteriaBuffer.AdCriteriaName =
adCampaignCriterion.criterion.type.ToString().Trim();
OutGAAdCriteriaBuffer.AdCriteriaCampaignID
= adCampaignCriterion.campaignId.ToString().Trim();
OutGAAdCriteriaBuffer.EndOfRowset();
i++;
} // For Each Ends
} // Check for records counts Ends
GAdWordsSelector.paging.IncreaseOffsetBy(10000);
} // Do Ends
while (GAdWordsSelector.paging.startIndex <
GAdWordsPage.totalNumEntries);
} // If Client Customer check Ends !!
} // Try Ends
catch (Exception ex)
{
StreamWriter writer = new
StreamWriter("c:\\GA_Groups_ErrorLog.txt");
writer.WriteLine(ex.Message.ToString());
writer.Close();
} // Catch Ends
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
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/c9311363-ec6d-4323-86d8-9dd290dffae4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.