Export Responses to CSV

The following is a sample code to export the responses to CSV file without using Survey Response List Web Control export feature:

CsvFile csvFile = CsvExporter.Export(survey, response);
csvFile.Export("responses.csv", this.Context);

You can also export the CSV file to a memory stream as following:

MemoryStream stream = csvFile.Export("responses.csv");

See Also