>
> Hi, Josh
>
I have Top level MCC which has a different Customer ID and many client
Adwords Accounts under this mcc account
My App.cofig does not have any settings i have commented them all
i have created a getUser function Which assign the config values
> This is Code file for GetCampaigns.vb from Adwords Project Code samples
> for Dot net
>
googleads-dotnet-lib-master\examples\AdWords\Vb\v201406\BasicOperations
I am using this v201406
Imports Google.Api.Ads.AdWords.Lib
Imports Google.Api.Ads.AdWords.v201406
Imports System
Imports System.Collections.Generic
Imports System.IO
Namespace Google.Api.Ads.AdWords.Examples.VB.v201406
''' <summary>
''' This code example lists all campaigns. To add a campaign, run
''' AddCampaign.vb.
'''
''' Tags: CampaignService.get
''' </summary>
Public Class GetCampaigns
Inherits ExampleBase
''' <summary>
''' Main method, to run this code example as a standalone application.
''' </summary>
''' <param name="args">The command line arguments.</param>
Public Shared Sub Main(ByVal args As String())
Dim codeExample As New GetCampaigns
Console.WriteLine(codeExample.Description)
Try
codeExample.Run()
Catch ex As Exception
Console.WriteLine("An exception occurred while running this code
example. {0}", _
ExampleUtilities.FormatException(ex))
End Try
End Sub
''' <summary>
''' Returns a description about the code example.
''' </summary>
Public Overrides ReadOnly Property Description() As String
Get
Return "This code example lists all campaigns. To add a campaign,
run AddCampaign.vb."
End Get
End Property
''' <summary>
''' Runs the code example.
''' </summary>
''' <param name="user">The AdWords user.</param>
Public Sub Run()
* Dim user As AdWordsUser*
* user = getUser()*
' Get the CampaignService.
Dim campaignService As CampaignService = user.GetService( _
AdWordsService.v201406.CampaignService)
' Create the selector.
Dim selector As New Selector
selector.fields = New String() {"Id", "Name", "Status"}
' Set the selector paging.
selector.paging = New Paging
Dim offset As Integer = 0
Dim pageSize As Integer = 500
Dim page As New CampaignPage
Try
Do
* TryCast(user.Config,
AdWordsAppConfig).ClientCustomerId = "746-686-2521"*
* ' This is my Clients **ClientCustomerId which i have
verified but i do not get any records for it *
* ' I Get 0 zero where as Campaigns Exist for this
Client which i have verified*
selector.paging.startIndex = offset
selector.paging.numberResults = pageSize
page = campaignService.get(selector)
' Display the results.
If ((Not page Is Nothing) AndAlso (Not page.entries Is
Nothing)) Then
Dim i As Integer = offset
For Each campaign As Campaign In page.entries
Console.WriteLine("{0}) Campaign with id =
'{1}', name = '{2}' and status = " & _
"'{3}' was found.", i, campaign.id,
campaign.name, campaign.status)
i += 1
Next
End If
offset = offset + pageSize
Loop While (offset < page.totalNumEntries)
Console.WriteLine("Number of campaigns found: {0}",
page.totalNumEntries)
Catch ex As Exception
Throw New System.ApplicationException("Failed to retrieve
campaign(s).", ex)
End Try
End Sub
Public Function getUser() As AdWordsUser
*'All this have correct values Which i have verified*
Try
* Dim user As New AdWordsUser()*
* Dim config As AdWordsAppConfig = DirectCast(user.Config,
AdWordsAppConfig)*
* config.AuthorizationMethod =
AdWordsAuthorizationMethod.OAuth2*
* config.OAuth2ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxx"*
* config.OAuth2ClientId =
"xxxxxxxxxxxxxxxxx-xxxxx.apps.googleusercontent.com"*
* config.OAuth2RefreshToken = "xxxxxxxxxxxxxxxxxx"*
* config.DeveloperToken = "xxxxxxxxxxxxxxxxxxx"*
Return user
Catch ex As Exception
Return Nothing
End Try
End Function
End Class
End Namespace
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
For more options, visit https://groups.google.com/d/optout.