/// <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 CampaignRemoteService instance. CampaignRemoteService service = (CampaignRemoteService) user.GetService( DfaService.v1_20.CampaignRemoteService); String searchString = _T("INSERT_SEARCH_STRING_CRITERIA_HERE"); // Create campaign search criteria structure. CampaignSearchCriteria searchCriteria = new CampaignSearchCriteria(); searchCriteria.pageSize = 10; searchCriteria.searchString = searchString; try { // Get the campaigns. CampaignRecordSet recordSet = service.getCampaignsByCriteria(searchCriteria); // Display campaign names and ids. if (recordSet.records != null) { foreach (Campaign result in recordSet.records) { Console.WriteLine("Campaign with name \"{0}\" and id \"{1}\" was found.", result.name, result.id); } } else { Console.WriteLine("No campaigns found for your search criteria."); } } catch (Exception ex) { Console.WriteLine("Failed to retrieve campaigns. Exception says \"{0}\"", ex.Message); } }
public CampaignRecordSet getCampaignsByCriteria(CampaignSearchCriteria searchCriteria) { object[] results = this.Invoke("getCampaignsByCriteria", new object[] {searchCriteria}); return ((CampaignRecordSet) (results[0])); }