/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE"));
      long creativeId = long.Parse(_T("INSERT_CREATIVE_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      // Create the campaign creative association structure.
      CampaignCreativeAssociation association = new CampaignCreativeAssociation();
      association.CreativeId = creativeId;

      // Insert the association.
      CampaignCreativeAssociation result =
          service.CampaignCreativeAssociations.Insert(association, profileId, campaignId).Execute();

      // Display a success message.
      Console.WriteLine("Creative with ID {0} is now associated with campaign {1}.",
          result.CreativeId, campaignId);
    }
示例#2
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE"));
            long creativeId = long.Parse(_T("INSERT_CREATIVE_ID_HERE"));
            long profileId  = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            // Create the campaign creative association structure.
            CampaignCreativeAssociation association = new CampaignCreativeAssociation();

            association.CreativeId = creativeId;

            // Insert the association.
            CampaignCreativeAssociation result =
                service.CampaignCreativeAssociations.Insert(association, profileId, campaignId).Execute();

            // Display a success message.
            Console.WriteLine("Creative with ID {0} is now associated with campaign {1}.",
                              result.CreativeId, campaignId);
        }
示例#3
0
        /// <summary>
        /// Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already.
        /// Documentation https://developers.google.com/dfareporting/v2.5beta1/reference/campaignCreativeAssociations/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated dfareporting service.</param>
        /// <param name="profileId">User profile ID associated with this request.</param>
        /// <param name="campaignId">Campaign ID in this association.</param>
        /// <param name="body">A valid dfareporting v2.5beta1 body.</param>
        /// <returns>CampaignCreativeAssociationResponse</returns>
        public static CampaignCreativeAssociation Insert(dfareportingService service, string profileId, string campaignId, CampaignCreativeAssociation body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (profileId == null)
                {
                    throw new ArgumentNullException(profileId);
                }
                if (campaignId == null)
                {
                    throw new ArgumentNullException(campaignId);
                }

                // Make the request.
                return(service.CampaignCreativeAssociations.Insert(body, profileId, campaignId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CampaignCreativeAssociations.Insert failed.", ex);
            }
        }