/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Create CreativeRemoteService instance. CreativeRemoteService service = (CreativeRemoteService) user.GetService( DfaService.v1_20.CreativeRemoteService); long creativeId = long.Parse(_T("INSERT_CREATIVE_ID")); long placementId = long.Parse(_T("INSERT_PLACEMENT_ID")); // Create creative placement assignment structure. CreativePlacementAssignment creativePlacementAssignment = new CreativePlacementAssignment(); creativePlacementAssignment.creativeId = creativeId; creativePlacementAssignment.placementId = placementId; creativePlacementAssignment.placementIds = new long[] {placementId}; try { // Assign creatives to placements. CreativePlacementAssignmentResult[] results = service.assignCreativesToPlacements( new CreativePlacementAssignment[] {creativePlacementAssignment}); // Display new ads that resulted from the assignment. foreach (CreativePlacementAssignmentResult result in results) { Console.WriteLine("Ad with name \"{0}\" and id \"{1}\" was created.", result.adName, result.adId); } } catch (Exception ex) { Console.WriteLine("Failed to create ad. Exception says \"{0}\"", ex.Message); } }
public CreativePlacementAssignmentResult[] assignCreativesToPlacements(CreativePlacementAssignment[] creativePlacementAssignments) { object[] results = this.Invoke("assignCreativesToPlacements", new object[] {creativePlacementAssignments}); return ((CreativePlacementAssignmentResult[]) (results[0])); }