/// <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 CreativeGroupRemoteService instance.
      CreativeGroupRemoteService service = (CreativeGroupRemoteService) user.GetService(
          DfaService.v1_20.CreativeGroupRemoteService);

      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));

      // Set up creative group search criteria structure.
      CreativeGroupSearchCriteria creativeGroupSearchCriteria = new CreativeGroupSearchCriteria();
      creativeGroupSearchCriteria.advertiserIds = new long[] {advertiserId};

      try {
        // Get creatives groups for the selected criteria.
        CreativeGroupRecordSet creativeGroups =
            service.getCreativeGroups(creativeGroupSearchCriteria);

        // Display creative group names, ids, advertiser ids, and group numbers.
        if (creativeGroups != null && creativeGroups.records != null) {
          foreach (CreativeGroup creativeGroup in creativeGroups.records) {
            Console.WriteLine("Creative group with name \"{0}\" , id \"{1}\", advertiser id " +
                "\"{2}\" and group number \"{3}\" was found.", creativeGroup.name,
                creativeGroup.id, creativeGroup.advertiserId, creativeGroup.groupNumber);
          }
        } else {
          Console.WriteLine("No creative groups found for your search criteria");
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to retrieve creative groups. Exception says \"{0}\"",
            ex.Message);
      }
    }
Exemplo n.º 2
0
 public CreativeGroupRecordSet getCreativeGroups(CreativeGroupSearchCriteria searchCriteria) {
   object[] results = this.Invoke("getCreativeGroups", new object[] {searchCriteria});
   return ((CreativeGroupRecordSet) (results[0]));
 }