/// <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_19.CreativeRemoteService);

              long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
              string assetName = _T("INSERT_SWF_ASSET_NAME_HERE");
              string pathToFile = _T("INSERT_PATH_TO_SWF_FILE_HERE");

              // Set HTML asset Structure.
              CreativeAsset swfAsset = new CreativeAsset();
              // Set it to true if this asset is being used for HTML creative.
              swfAsset.forHTMLCreatives = true;
              swfAsset.advertiserId = advertiserId;
              swfAsset.content = MediaUtilities.GetAssetDataFromUrl(new Uri(pathToFile));
              swfAsset.name = assetName;

              try {
            //Create asset.
            CreativeAssetSaveResult result = service.saveCreativeAsset(swfAsset);

            // Display asset file name.
            Console.WriteLine("Asset was saved with file name of \"{0}\".", result.savedFilename);
              } catch (Exception e) {
            Console.WriteLine("Failed to create html asset. Exception says \"{0}\"",
            e.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) {
      // Request the creative service from the service client factory.
      CreativeRemoteService creativeService = (CreativeRemoteService) user.GetService(
          DfaService.v1_19.CreativeRemoteService);

      string assetName = _T("INSERT_ASSET_NAME_HERE");
      string pathToFile = _T("INSERT_PATH_TO_FILE_HERE");
      long creativeId = long.Parse(_T("INSERT_IN_STREAM_VIDEO_CREATIVE_ID_HERE"));

      // Create the In-Stream video creative asset.
      CreativeAsset inStreamVideoAsset = new CreativeAsset();
      inStreamVideoAsset.name = assetName;
      inStreamVideoAsset.content = MediaUtilities.GetAssetDataFromUrl(
          new Uri(pathToFile).AbsolutePath);

      // Create an upload request to make this asset a media file for an existing
      // In-Stream creative.
      InStreamAssetUploadRequest inStreamAssetUploadRequest = new InStreamAssetUploadRequest();
      inStreamAssetUploadRequest.mediaFile = true;
      inStreamAssetUploadRequest.inStreamAsset = inStreamVideoAsset;
      inStreamAssetUploadRequest.creativeId = creativeId;

      try {
        // Save the media file.
        InStreamVideoCreative inStreamVideoCreative =
            creativeService.uploadInStreamAsset(inStreamAssetUploadRequest);

        // Display a success message.
        Console.WriteLine("Added a media file to In-Stream video creative with ID \"{0}\".",
            inStreamVideoCreative.id);
      } catch (Exception ex) {
        Console.WriteLine("Failed to add a media file to in-stream video creative. " +
            "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) {
      // Request the creative service from the service client factory.
      CreativeRemoteService creativeService = (CreativeRemoteService) user.GetService(
          DfaService.v1_19.CreativeRemoteService);

      string assetName = _T("INSERT_ASSET_NAME_HERE");
      string pathToFile = _T("INSERT_PATH_TO_FILE_HERE");
      long creativeId = long.Parse(_T("INSERT_IN_STREAM_VIDEO_CREATIVE_ID_HERE"));
      string assetToReplace = _T("INSERT_ASSET_TO_REPLACE_HERE");

      // Create the In-Stream creative asset.
      CreativeAsset inStreamVideoAsset = new CreativeAsset();
      inStreamVideoAsset.name = assetName;
      inStreamVideoAsset.content = MediaUtilities.GetAssetDataFromUrl(
          new Uri(pathToFile).AbsoluteUri);

      // Create an upload request to make this asset a companion ad file for an
      // existing In-Stream video creative.
      InStreamAssetUploadRequest inStreamAssetUploadRequest = new InStreamAssetUploadRequest();
      inStreamAssetUploadRequest.companion = true;
      inStreamAssetUploadRequest.inStreamAsset = inStreamVideoAsset;
      inStreamAssetUploadRequest.creativeId = creativeId;

      try {
        // Replace the existing asset with a newly uploaded asset.
        InStreamVideoCreative inStreamVideoCreative =
            creativeService.replaceInStreamAsset(assetToReplace, inStreamAssetUploadRequest);

        // Display a success message.
        Console.WriteLine("Replaced companion ad asset \"{0}\" in In-Stream video creative "
            + "with ID \"{1}\".%n", assetToReplace, inStreamVideoCreative.id);

      } catch (Exception ex) {
        Console.WriteLine("Failed to replace companion ad asset in in-stream video creative. " +
            "Exception says \"{0}\"", ex.Message);
      }
    }
 public CreativeAssetSaveResult saveCreativeAsset(CreativeAsset creativeAsset) {
   object[] results = this.Invoke("saveCreativeAsset", new object[] {creativeAsset});
   return ((CreativeAssetSaveResult) (results[0]));
 }