/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the ThirdpartySlotService. ThirdPartySlotService thirdPartySlotService = (ThirdPartySlotService) user.GetService(DfpService.v201302.ThirdPartySlotService); // Set the company ID to associate with this third party slot. long companyId = long.Parse(_T("INSERT_COMPANY_ID_HERE")); // Set the external unique ID to associate with this third party slot. string externalUniqueId = _T("INSERT_EXTERNAL_UNIQUE_ID_HERE"); // Set the external unique name to associate with this third party slot. string externalUniqueName = _T("INSERT_EXTERNAL_UNIQUE_NAME_HERE"); // Set the creative IDs to associate with this third party slot. long[] creativeIds = new long[] {long.Parse(_T("INSERT_CREATIVE_ID_HERE"))}; // Create the ThirdPartySlot object. ThirdPartySlot thirdPartySlot = new ThirdPartySlot(); thirdPartySlot.companyId = companyId; thirdPartySlot.description = "Third party slot description."; thirdPartySlot.externalUniqueId = externalUniqueId; thirdPartySlot.externalUniqueName = externalUniqueName; // Set the creatives that the third party slots will represent. thirdPartySlot.creativeIds = creativeIds; try { // Create the third party slot. thirdPartySlot = thirdPartySlotService.createThirdPartySlot(thirdPartySlot); if (thirdPartySlot != null) { Console.WriteLine("A third party slot with ID \"{0}\" and named \"{1}\" was created.", thirdPartySlot.id, thirdPartySlot.externalUniqueName); } else { Console.WriteLine("No third party slot created."); } } catch (Exception ex) { Console.WriteLine("Failed to create third party slots. Exception says \"{0}\"", ex.Message); } }
public ThirdPartySlot updateThirdPartySlot(ThirdPartySlot thirdPartySlot) { object[] results = this.Invoke("updateThirdPartySlot", new object[] { thirdPartySlot }); return ((ThirdPartySlot) (results[0])); }