Hi,

I was trying to create an Ad for a Display Campaign using TemplateAd with 
an ID 247. I was able to create an ad with template id: 49.

Below is the error message that i retrieved:

The user does not have permissions to create a template ad for the given 
template.. (Error: AdError.USER_DOES_NOT_HAVE_ACCESS_TO_TEMPLATE, 
FieldPath: operations[0].operand.ad.templateId, Trigger: 247)
Missing required template fields. (Error: 
AdError.MISSING_REQUIRED_TEMPLATE_FIELDS, FieldPath: 
operations[0].operand.ad.templateElements[0].variationSpecificFieldOverrides, 
Trigger: poster)

Below is the code that I use to create the template ad:
 
           TemplateElementField video = new TemplateElementField();
            video.name = "video";
            video.fieldMedia = firstVideo;
            video.type = TemplateElementFieldType.VIDEO;
            
            
            var playImage = new Image()
            {
                data = 
MediaUtilities.GetAssetDataFromUrl("https://upload.wikimedia.org/wikipedia/commons/5/5b/Goldfish_icon.jpg";,
 
_user.Config),
                type = MediaMediaType.IMAGE
            };

            var newPlayImage = (Image) _mediaService.upload(new Media[] 
{playImage})[0];
            
            
            var image = new Image()
            {
                data = 
MediaUtilities.GetAssetDataFromUrl("https://goo.gl/3b9Wfh";, _user.Config),
                type = MediaMediaType.IMAGE
            };

            var newImage = (Image) _mediaService.upload(new Media[] 
{image})[0];
            
            TemplateElementField poster = new TemplateElementField();
            poster.name = "poster";
            poster.fieldMedia = newImage;
            poster.type = TemplateElementFieldType.BACKGROUND_IMAGE;
//            
            TemplateElement adData = new TemplateElement();
            adData.uniqueName = "adData";
            adData.fields = new[] {poster, video};
            
            var videoAd = new TemplateAd() {
                name = "Ad for Video",
                templateId = 247,
                templateElements = new TemplateElement[] {adData},
                finalUrls = new string[] { "http://example.com/html5"; },
                displayUrl = "www.example.com/html5",
                dimensions = new Dimensions()
                {
                    width = 300,
                    height = 250
                }
            };

Regards,

Amri

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c2131ea9-6dbe-4345-9ee6-8844c82ffa1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to