Closed digitalgym closed 5 years ago
Found the solution, you need to ADD the asset then use both the assetId and the youTubeVideoId from the url. Would be good to have this added to the examples.
youTubeVideos = new AssetLink[] { new AssetLink { asset = new Google.Api.Ads.AdWords.v201809.YouTubeVideoAsset { youTubeVideoId = "youtubeVideoID" assetId = "assetId"} } }
private long UploadYouTubeAsset(string url)
{
using (AssetService assetService =
(AssetService)user.GetService(AdWordsService.v201809.AssetService))
{
YouTubeVideoAsset imageAsset = new YouTubeVideoAsset
{
youTubeVideoId = url
};
// Create the image asset.
// Create the operation.
AssetOperation operation = new AssetOperation()
{
@operator = Operator.ADD,
operand = imageAsset
};
// Create the asset and return the ID.
return assetService.mutate(new AssetOperation[]
{
operation
}).value[0].assetId;
}
}
Are there any examples of how to provide an existing Youtube video as an asset when creating a Multi-Asset Ad? The below throws an error "operations[0].operand.ad.youtubeVideos[0].asset.assetId"
youTubeVideos = new AssetLink[] { new AssetLink { asset = new Google.Api.Ads.AdWords.v201809.YouTubeVideoAsset { youTubeVideoId = "youtubeVideoID" } } }
Could an example be added here? https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201809/AdvancedOperations/AddMultiAssetResponsiveDisplayAd.cs