/// <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 advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));

              // Set up creative search criteria structure.
              CreativeSearchCriteria creativeSearchCriteria = new CreativeSearchCriteria();
              creativeSearchCriteria.pageSize = 10;
              creativeSearchCriteria.advertiserId = advertiserId;

              try {
            // Get creatives for the selected criteria.
            CreativeRecordSet creatives = service.getCreatives(creativeSearchCriteria);

            // Display creative name and its id.
            if (creatives != null && creatives.records != null) {
              foreach (CreativeBase result in creatives.records) {
            Console.WriteLine("Creative with name \"{0}\" and id \"{1}\" was found.",
                result.name, result.id);
              }
            } else {
              Console.WriteLine("No creatives found for your criteria");
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to retrieve creatives. Exception says \"{0}\"", e.Message);
              }
        }
Пример #2
0
 public CreativeRecordSet getCreatives(CreativeSearchCriteria searchCriteria) {
   object[] results = this.Invoke("getCreatives", new object[] {searchCriteria});
   return ((CreativeRecordSet) (results[0]));
 }