/// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the LabelService.
              LabelService labelService =
              (LabelService) user.GetService(DfpService.v201411.LabelService);

              // Set the ID of the label to deactivate.
              int labelId = int.Parse(_T("INSERT_LABEL_ID_HERE"));

              // Create statement text to select the label.
              StatementBuilder statementBuilder = new StatementBuilder()
              .Where("id = :id")
              .OrderBy("id ASC")
              .Limit(1)
              .AddValue("id", labelId);

              // Set default for page.
              LabelPage page = new LabelPage();

              try {
            do {
              // Get labels by statement.
              page = labelService.getLabelsByStatement(statementBuilder.ToStatement());

              if (page.results != null) {
            int i = page.startIndex;
            foreach (Label label in page.results) {
              Console.WriteLine("{0}) Label with ID '{1}', name '{2}' will be deactivated.",
                  i, label.id, label.name);
              i++;
            }
              }
              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while (statementBuilder.GetOffset() < page.totalResultSetSize);

            Console.WriteLine("Number of labels to be deactivated: " + page.totalResultSetSize);

            // Modify statement for action.
            statementBuilder.RemoveLimitAndOffset();

            // Create action.
            DeactivateLabels action = new DeactivateLabels();

            // Perform action.
            UpdateResult result = labelService.performLabelAction(action,
            statementBuilder.ToStatement());

            // Display results.
            if (result != null && result.numChanges > 0) {
              Console.WriteLine("Number of labels deactivated: " + result.numChanges);
            } else {
              Console.WriteLine("No labels were deactivated.");
            }
              } catch (Exception e) {
            Console.WriteLine("Failed to deactivate labels. Exception says \"{0}\"", e.Message);
              }
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the LabelService.
              LabelService labelService =
              (LabelService) user.GetService(DfpService.v201411.LabelService);

              // Create a statement to only select labels that are competitive
              // sorted by name.
              StatementBuilder statementBuilder = new StatementBuilder()
              .Where ("type = :type")
              .OrderBy("name ASC")
              .Limit (StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .AddValue("type", LabelType.COMPETITIVE_EXCLUSION.ToString());

              // Set default for page
              LabelPage page = new LabelPage();

              try {
            do {
              // Get labels by statement.
              page = labelService.getLabelsByStatement(statementBuilder.ToStatement());

              if (page.results != null) {
            int i = page.startIndex;
            foreach (Label label in page.results) {
              StringBuilder builder = new StringBuilder();
              foreach (LabelType labelType in label.types) {
                builder.AppendFormat("{0} | ", labelType);
              }

              Console.WriteLine("{0}) Label with ID '{1}', name '{2}'and type '{3}' was found.",
                  i, label.id, label.name, builder.ToString().TrimEnd(' ', '|'));
              i++;
            }
              }
              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while(statementBuilder.GetOffset() < page.totalResultSetSize);
            Console.WriteLine("Number of results found: " + page.totalResultSetSize);
              } catch (Exception e) {
            Console.WriteLine("Failed to get labels. Exception says \"{0}\"", e.Message);
              }
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the LabelService.
      LabelService labelService =
          (LabelService) user.GetService(DfpService.v201411.LabelService);

      // Create a statement to get all labels.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      LabelPage page = new LabelPage();

      try {
        do {
          // Get labels by statement.
          page = labelService.getLabelsByStatement(statementBuilder.ToStatement());

          if (page.results != null) {
            int i = page.startIndex;
            foreach (Label label in page.results) {
              StringBuilder builder = new StringBuilder();
              foreach (LabelType labelType in label.types) {
                builder.AppendFormat("{0} | ", labelType);
              }

              Console.WriteLine("{0}) Label with ID '{1}', name '{2}' and type '{3}' was found.",
                  i, label.id, label.name, builder.ToString().TrimEnd(' ', '|'));
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get labels. Exception says \"{0}\"", ex.Message);
      }
    }