CSVExport
public sealed class CSVExportExports selected Asset Inventory fields and rows to a configurable comma-separated file.
Fields
Section titled “Fields”
DEFAULT_FILE_NAME
Section titled “DEFAULT_FILE_NAME”public const string DEFAULT_FILE_NAME = "assets.csv"Returns
System.String
Methods
Section titled “Methods”
GetDefaultFields()
Section titled “GetDefaultFields()”public static List<string> GetDefaultFields()Returns a new list of the recommended package fields used when no CSV column selection was saved.
Returns
System.Collections.Generic.List{System.String}
GetAllFields()
Section titled “GetAllFields()”public static List<string> GetAllFields()Returns every readable AssetInfo property as a selectable CSV field path.
Returns
System.Collections.Generic.List{System.String}
EnsureSettings(CSVExportSettings)
Section titled “EnsureSettings(CSVExportSettings)”public static void EnsureSettings(CSVExportSettings settings)Initializes missing CSV column and separator settings while preserving caller-selected values.
Parameters
| Name | Type |
|---|---|
settings |
AssetInventory.CSVExportSettings |
Run(List, CSVExportSettings, string)
Section titled “Run(List, CSVExportSettings, string)”public Task Run(List<AssetInfo> assets, CSVExportSettings settings, string filePath)Writes the selected package rows to the requested CSV file, creating its parent directory when necessary.
Parameters
| Name | Type |
|---|---|
assets |
System.Collections.Generic.List{AssetInventory.AssetInfo} |
settings |
AssetInventory.CSVExportSettings |
filePath |
System.String |
Returns
System.Threading.Tasks.Task
BuildLines(List, CSVExportSettings)
Section titled “BuildLines(List, CSVExportSettings)”public List<string> BuildLines(List<AssetInfo> assets, CSVExportSettings settings)Builds escaped CSV header and data rows in memory without writing a file.
Parameters
| Name | Type |
|---|---|
assets |
System.Collections.Generic.List{AssetInventory.AssetInfo} |
settings |
AssetInventory.CSVExportSettings |
Returns
System.Collections.Generic.List{System.String}
Constructors
Section titled “Constructors”
CSVExport()
Section titled “CSVExport()”public CSVExport()