Hi All,
Is there a way to get campaign with all their elements (adGroup, ads) after performing a Mutate action?
I asked this question, because a want to get AdGroup and Ads status after updating campaign status.
I'm using Google AdWords API. You can find bellow my piece of code.
using (Google.Api.Ads.AdWords.v201809.CampaignService campaignService = (Google.Api.Ads.AdWords.v201809.CampaignService)user.GetService(AdWordsService.v201809.CampaignService))
{
Google.Api.Ads.AdWords.v201809.Campaign campaign = new Google.Api.Ads.AdWords.v201809.Campaign
{
id = campaignId,
status = CampaignStatus.ENABLED
};
Google.Api.Ads.AdWords.v201809.CampaignOperation operation = new Google.Api.Ads.AdWords.v201809.CampaignOperation
{
operand = campaign,
@operator = Operator.SET
};
try
{
CampaignReturnValue retVal = campaignService.mutate(new Google.Api.Ads.AdWords.v201809.CampaignOperation[]
{
operation
});
AddAPILog(SocialMedia.Google, "ActiveCampaign", "", campaign, retVal, "PUT", "ActiveCampaign", user.Config.OAuth2RefreshToken, null, true);
return true;
}
catch (Exception e)
{
AddAPILog(SocialMedia.Google, "ActiveCampaign", "", campaign, "", "PUT", "ActiveCampaign", user.Config.OAuth2RefreshToken, null, true);
return false;
}
}
Thanks,
Zied