Retrieve All Parameter Data Types Using the Revit API


// Get all data types from the ParameterType enumeration
var types = Enum.GetValues(typeof (ParameterType));

// Cast to list
var typeStrings = new List < string > ();

foreach(var t in types) {
  typeStrings.Add(t.ToString());
}

// Write the array to a text file in the temp directory
var filePath = System.IO.Path.GetTempPath() + "para_data_types.txt";
File.WriteAllLines(filePath, typeStrings);

// Instantiate a Task Dialog to display to the user in Revit
TaskDialog td = new TaskDialog("Parameter Data Types");
td.MainInstruction = string.Format("Exported {0} data types.", typeStrings.Count().ToString());
td.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Open Text File");
td.CommonButtons = TaskDialogCommonButtons.Ok;
TaskDialogResult tdRes = td.Show();

// Show a Task Dialog and allow the user to open the exported text file
if (tdRes == TaskDialogResult.CommandLink1) {
  System.Diagnostics.Process.Start(filePath);
}