Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PISystem.ExportCsv Method (Object, IList(Type), IList(String), PIExportMode, CultureInfo, String, Object, Object, EventHandler(AFProgressEventArgs))

PISystem.ExportCsv Method (Object, IList(Type), IList(String), PIExportMode, CultureInfo, String, Object, Object, EventHandler(AFProgressEventArgs))

  • Last UpdatedNov 18, 2025
  • 5 minute read
PISystem.ExportCsv Method (Object, IList(Type), IList(String), PIExportMode, CultureInfo, String, Object, Object, EventHandler(AFProgressEventArgs))
Exports the representation of requested object(s) in comma-separated (CSV) format to a file.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public void ExportCsv(
	Object exportObject,
	IList<Type> objTypes,
	IList<string> columnHeaders,
	PIExportMode exportMode,
	CultureInfo culture,
	string file,
	Object startTime,
	Object endTime,
	EventHandler<AFProgressEventArgs> eventHandler
)
Public Sub ExportCsv ( 
	exportObject As Object,
	objTypes As IList(Of Type),
	columnHeaders As IList(Of String),
	exportMode As PIExportMode,
	culture As CultureInfo,
	file As String,
	startTime As Object,
	endTime As Object,
	eventHandler As EventHandler(Of AFProgressEventArgs)
)

Dim instance As PISystem
Dim exportObject As Object
Dim objTypes As IList(Of Type)
Dim columnHeaders As IList(Of String)
Dim exportMode As PIExportMode
Dim culture As CultureInfo
Dim file As String
Dim startTime As Object
Dim endTime As Object
Dim eventHandler As EventHandler(Of AFProgressEventArgs)

instance.ExportCsv(exportObject, objTypes, 
	columnHeaders, exportMode, culture, 
	file, startTime, endTime, eventHandler)
public:
void ExportCsv(
	Object^ exportObject, 
	IList<Type^>^ objTypes, 
	IList<String^>^ columnHeaders, 
	PIExportMode exportMode, 
	CultureInfo^ culture, 
	String^ file, 
	Object^ startTime, 
	Object^ endTime, 
	EventHandler<AFProgressEventArgs^>^ eventHandler
)
member ExportCsv : 
        exportObject : Object * 
        objTypes : IList<Type> * 
        columnHeaders : IList<string> * 
        exportMode : PIExportMode * 
        culture : CultureInfo * 
        file : string * 
        startTime : Object * 
        endTime : Object * 
        eventHandler : EventHandler<AFProgressEventArgs> -> unit 

Parameters

exportObject
Type: SystemObject
The object to return in CSV format.
objTypes
Type: System.Collections.GenericIListType
An optional list of types that are to be exported. For example, for elements, if the user wanted to export attributes, but not ports or extended properties, the list should only contain typeof(AFElement) and typeof(AFAttribute). If null, all types owned by the export object will be exported.
columnHeaders
Type: System.Collections.GenericIListString
The names of the desired columns whose values are to be exported.
exportMode
Type: OSIsoft.AFPIExportMode
One or more of the PIExportMode values which indicates how data should be exported. Only PIExportMode.SimplifiedConfigStrings and PIIExportMode.AppendUnitsOfMeasure are valid for CSV export. Others are ignored.
culture
Type: System.GlobalizationCultureInfo
The culture-specific settings to be used for conversion of times, dates, floating-point values, etc. If , the current culture will be assumed. If the invariant culture is specified, then DateTime's will be output in Utc time.
file
Type: SystemString
The file to which the exported Csv information should be written. If the file already exists, it will be overwritten.
startTime
Type: SystemObject
An object representing the earliest starting time for AFEventFrame, AFTransfer, and AFCase objects that may be part of the exported object. Use if no event frame type objects are to be included. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on the object's QueryDate.
endTime
Type: SystemObject
An object representing the latest ending time for AFEventFrame, AFTransfer, and AFCase objects that may be part of the exported object. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on the object's QueryDate.
eventHandler
Type: SystemEventHandlerAFProgressEventArgs
Delegate used to receive progress indication on operations.

Remarks

Exports the CSV representation of requested object(s) and writes it to a file

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in