/// <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 CreativeFieldRemoteService instance. CreativeFieldRemoteService service = (CreativeFieldRemoteService)user.GetService( DfaService.v1_20.CreativeFieldRemoteService); long creativeFieldId = long.Parse(_T("INSERT_CREATIVE_FIELD_ID_HERE")); String creativeFieldValueName = _T("INSERT_CREATIVE_FIELD_VALUE_NAME_HERE"); // Create creative field value structure. CreativeFieldValue creativeFieldValue = new CreativeFieldValue(); creativeFieldValue.id = -1; creativeFieldValue.name = creativeFieldValueName; creativeFieldValue.creativeFieldId = creativeFieldId; try { // Create creative field value. CreativeFieldValueSaveResult creativeFieldValueSaveResult = service.saveCreativeFieldValue(creativeFieldValue); // Display creative field value id. Console.WriteLine("Creative field value with id \"{0}\" was created.", creativeFieldValueSaveResult.id); } catch (Exception ex) { Console.WriteLine("Failed to add creative field value. Exception says \"{0}\"", ex.Message); } }
/// <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 CreativeFieldRemoteService instance. CreativeFieldRemoteService service = (CreativeFieldRemoteService)user.GetService( DfaService.v1_20.CreativeFieldRemoteService); long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE")); string creativeFieldName = _T("INSERT_CREATIVE_FIELD_NAME_HERE"); // Create creative field structure. CreativeField creativeField = new CreativeField(); creativeField.id = -1; creativeField.name = creativeFieldName; creativeField.advertiserId = advertiserId; try { // Create creative field. CreativeFieldSaveResult creativeFieldSaveResult = service.saveCreativeField(creativeField); // Display creative field id. Console.WriteLine("Creative field with id \"{0}\" was created.", creativeFieldSaveResult.id); } catch (Exception ex) { Console.WriteLine("Failed to add creative field. Exception says \"{0}\"", ex.Message); } }
/// <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 CreativeFieldRemoteService instance. CreativeFieldRemoteService service = (CreativeFieldRemoteService)user.GetService( DfaService.v1_20.CreativeFieldRemoteService); String searchString = _T("INSERT_SEARCH_STRING_CRITERIA_HERE"); // Set up creative field search criteria structure. CreativeFieldSearchCriteria creativeFieldSearchCriteria = new CreativeFieldSearchCriteria(); creativeFieldSearchCriteria.pageSize = 10; creativeFieldSearchCriteria.searchString = searchString; try { // Get creative fields for the selected criteria. CreativeFieldRecordSet creativeFields = service.getCreativeFields(creativeFieldSearchCriteria); // Display creative field names, ids, advertiser ids, and number of values. if (creativeFields != null && creativeFields.records != null) { foreach (CreativeField creativeField in creativeFields.records) { Console.WriteLine("Creative field with name \"{0}\", id \"{1}\", Advertiser id " + "\"{2}\", and containing \"{3}\" values was found.", creativeField.name, creativeField.id, creativeField.advertiserId, creativeField.totalNumberOfValues); } } else { Console.WriteLine("No creative fields found for your search criteria"); } } catch (Exception ex) { Console.WriteLine("Failed to retrieve creative fields. Exception says \"{0}\"", ex.Message); } }
/// <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 CreativeFieldRemoteService instance. CreativeFieldRemoteService service = (CreativeFieldRemoteService)user.GetService( DfaService.v1_19.CreativeFieldRemoteService); String searchString = _T("INSERT_SEARCH_STRING_CRITERIA_HERE"); // Set up creative field value search criteria structure. CreativeFieldValueSearchCriteria creativeValueSearchCriteria = new CreativeFieldValueSearchCriteria(); creativeValueSearchCriteria.pageSize = 10; creativeValueSearchCriteria.searchString = searchString; try { // Get creative field values for the selected criteria. CreativeFieldValueRecordSet creativeFieldValues = service.getCreativeFieldValues(creativeValueSearchCriteria); // Display creative field value names and ids. if (creativeFieldValues != null && creativeFieldValues.records != null) { foreach (CreativeFieldValue creativeFieldValue in creativeFieldValues.records) { Console.WriteLine("Creative field value with name \"{0}\" and id \"{1}\" was found.", creativeFieldValue.name, creativeFieldValue.id); } } else { Console.WriteLine("No creative field values found for your criteria"); } } catch (Exception ex) { Console.WriteLine("Failed to retrieve creative field values. Exception says \"{0}\"", ex.Message); } }