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

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

              // Create change log search criteria structure.
              ChangeLogRecordSearchCriteria searchCritera = new ChangeLogRecordSearchCriteria();
              searchCritera.pageSize = 10;
              searchCritera.objectId = advertiserId;
              // The following field has been filled in to choose advertiser change
              // logs. This values was determined using GetChangeLogObjectTypes.cs.
              searchCritera.objectTypeId = 1;

              try {
            // Get change log record set.
            ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCritera);

            // Set up a formatter to make the change log timestamps human-readable.
            string dateFormat = "yyyy-M-d H:m:s";

            // Display the contents of each change log record
            if (changeLogRecordSet != null && changeLogRecordSet.records != null) {
              foreach (ChangeLogRecord changeLogRecord in changeLogRecordSet.records) {
            Console.WriteLine("Action \"{0}\", Context \"{1}\", Change Date \"{2}\", New Value " +
                "\"{3}\", Old Value \"{4}\", Profile Name \"{5}\" was found.",
                changeLogRecord.action, changeLogRecord.context,
                changeLogRecord.changeDate.Value.ToString(dateFormat), changeLogRecord.newValue,
                changeLogRecord.oldValue, changeLogRecord.username);
              }
            } else {
              Console.WriteLine("No change logs found for your search criteria.");
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to retrieve change logs. Exception says \"{0}\"",
            e.Message);
              }
        }
Example #2
0
 public ChangeLogRecordSet getChangeLogRecords(ChangeLogRecordSearchCriteria criteria) {
   object[] results = this.Invoke("getChangeLogRecords", new object[] {criteria});
   return ((ChangeLogRecordSet) (results[0]));
 }