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

              long campaignId = long.Parse(_T("INSERT_CAMPAIGN_ID_HERE"));
              long placementId = long.Parse(_T("INSERT_PLACEMENT_ID_HERE"));

              // Set placement tag search criteria.
              PlacementTagCriteria placementTagCriteria = new PlacementTagCriteria();
              placementTagCriteria.id = placementId;

              try {
            // Get placement tag options.
            PlacementTagOption[] placementTagOptions = service.getRegularPlacementTagOptions();

            long[] tagOptionIds = new long[placementTagOptions.Length];

            // Add all types of tags to the tag option structure.
            for (int i = 0; i < placementTagOptions.Length; i++) {
              tagOptionIds[i] = placementTagOptions[i].id;
            }

            placementTagCriteria.tagOptionIds = tagOptionIds;

            // Get HTML tags for the placements.
            PlacementTagData placementTagData = service.getPlacementTagData(campaignId,
            new PlacementTagCriteria[] {placementTagCriteria});

            // Display tags for the placement id used as criteria.
            PlacementTagInfo temp = placementTagData.placementTagInfos[0];
            Console.WriteLine("Placement name : {0}\nIframe/JavaScript tag : {1}\nStandard tag : {2}" +
            "\nInternal Redirect tag : {3}", temp.placement.name, temp.iframeJavaScriptTag,
            temp.javaScriptTag, temp.internalRedirectTag);
              } catch (Exception e) {
            Console.WriteLine("Failed to download tags. Exception says \"{0}\"",
            e.Message);
              }
        }
Example #2
0
 public PlacementTagData getPlacementTagData(long campaignId, PlacementTagCriteria[] placementTagCriterias) {
   object[] results = this.Invoke("getPlacementTagData", new object[] {campaignId, placementTagCriterias});
   return ((PlacementTagData) (results[0]));
 }