/// <summary> /// Run the code example. /// </summary> public void Run(DfpUser user) { using (CreativeWrapperService creativeWrapperService = (CreativeWrapperService)user.GetService( DfpService.v201802.CreativeWrapperService)) { long creativeWrapperId = long.Parse(_T("INSERT_CREATIVE_WRAPPER_ID_HERE")); try { StatementBuilder statementBuilder = new StatementBuilder() .Where("id = :id") .OrderBy("id ASC") .Limit(1) .AddValue("id", creativeWrapperId); CreativeWrapperPage page = creativeWrapperService.getCreativeWrappersByStatement( statementBuilder.ToStatement()); CreativeWrapper wrapper = page.results[0]; wrapper.ordering = CreativeWrapperOrdering.OUTER; // Update the creative wrappers on the server. CreativeWrapper[] creativeWrappers = creativeWrapperService.updateCreativeWrappers( new CreativeWrapper[] { wrapper }); // Display results. foreach (CreativeWrapper createdCreativeWrapper in creativeWrappers) { Console.WriteLine("Creative wrapper with ID '{0}' and wrapping order '{1}' was " + "updated.", createdCreativeWrapper.id, createdCreativeWrapper.ordering); } } catch (Exception e) { Console.WriteLine("Failed to update creative wrappers. Exception says \"{0}\"", e.Message); } } }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Create the CreativeWrapperService. CreativeWrapperService creativeWrapperService = (CreativeWrapperService)user.GetService( DfpService.v201311.CreativeWrapperService); long creativeWrapperId = long.Parse(_T("INSERT_CREATIVE_WRAPPER_ID_HERE")); try { CreativeWrapper wrapper = creativeWrapperService.getCreativeWrapper(creativeWrapperId); if (wrapper != null) { wrapper.ordering = CreativeWrapperOrdering.OUTER; // Update the creative wrappers on the server. CreativeWrapper[] creativeWrappers = creativeWrapperService.updateCreativeWrappers( new CreativeWrapper[] { wrapper }); // Display results. Console.WriteLine("Creative wrapper with ID '{0}' and wrapping order '{1}' was " + "updated.", creativeWrappers[0].id, creativeWrappers[0].ordering); } else { Console.WriteLine("No creative wrappers found to update."); } } catch (Exception ex) { Console.WriteLine("Failed to update creative wrappers. Exception says \"{0}\"", ex.Message); } }