i'm using the AdGroupAdService service to create a template ad of HTML 5 bundle type
i manage to create the ads (all sizes) but i need to find a way to update the content (due to some changes in the html)
public long SaveHTMLTemplateAd(HTMLTemplateAdDetails Details)
{
var service = (AdGroupAdService)this.user.GetService(AdWordsService.v201708.AdGroupAdService);
// TemplateAds
// types, fields names and more info can be found here:
// note! beside each template type you can find its id, the supported dimensions and fields
var templateAd = new TemplateAd()
{
name = Details.Name,
templateId = Details.TemplateId,
finalUrls = new string[] { Details.URL },
displayUrl = Details.URL,
dimensions = new Dimensions() {
width = Details.Width,
height = Details.Height
}
};
var mediaBundle = new MediaBundle()
{
data = Details.ZipFileContent,
entryPoint = "index.html",
type = MediaMediaType.MEDIA_BUNDLE
};
templateAd.templateElements = new TemplateElement[] {
new TemplateElement() {
uniqueName = "adData",
fields = new TemplateElementField[] {
new TemplateElementField() {
name = "Custom_layout",
fieldMedia = mediaBundle,
type = TemplateElementFieldType.MEDIA_BUNDLE
},
new TemplateElementField() {
name = "layout",
fieldText = "Custom",
type = TemplateElementFieldType.ENUM
},
},
}
};
var adGroupAd = new AdGroupAd
{
ad = templateAd,
adGroupId = Details.AdGroupId
};
var operations = new AdGroupAdOperation[] {
new AdGroupAdOperation {
@operator = Operator.ADD,
operand = adGroupAd
}
};
var adGroupAdReturnValue1 = service.mutate(operations);
return adGroupAdReturnValue1.value.First().
ad.id;
}