I have the following code that returns a .CSV file when a link is clicked for a user to save:
public FileContentResult DownloadCSV()
{
StringBuilder sb = new StringBuilder();
var props = typeof(PenCalcModel).GetProperties();
var penSummary = PenSummaryReport(new DateTime(DateTime.Today.Ticks, DateTimeKind.Utc), new DateTime(DateTime.Today.AddDays(1).Ticks, DateTimeKind.Utc), "");
foreach (PenCalcModel item in penSummary)
{
sb.Append(string.Join(",", props.Select(p=>p.GetValue(item,null).ToString())));
sb.AppendLine();
}
return File(new System.Text.UTF8Encoding().GetBytes(sb.ToString()), "text/csv", "PenReport.csv");
}
Is there a way where I could set it up to have this exact same .CSV file exported from the server to a networked drive every X hours?