Archived Forum PostQuestion:
I'm trying to make a UWP that pulls the data from a csv file and then sorts it alphabetically by column using the chilkat RTC for UWP more specifically the chilkat csv library , with that being said I wanted to first test it using the example code given on the chilkat website: https://www.example-code.com/csharp_winrt/csv_read.asp and https://www.example-code.com/csharp_winrt/csv_create.asp . However after I run the code both the methods LoadFile and SaveFile return Windows error 0x2: "The system cannot find the specified file." and windows error 0x5: "Access is denied." respectively. After some research, I found that since UWP doesn't allow access to the documents folder so I added the uap capability for documents folder to no avail. I just need some insight or at least a push in the right direction. I have been stuck on this for a while.
-Calvin
ChilkatLog:
SaveFile:
DllDate: Jun 15 2016
ChilkatVersion: 9.5.0.58
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
VerboseLogging: 0
WindowsError: Access is denied.
WindowsErrorCode: 0x5
win32CreateFileAnsi failed.
localFilePath: out.csv
currentWorkingDirectory: \Windows
localWindowsFilePath: out.csv
filename: out.csv
Failed to write complete file (7)
Failed.
--SaveFile
--ChilkatLog
ChilkatLog:
LoadFile:
DllDate: Jun 15 2016
ChilkatVersion: 9.5.0.58
UnlockPrefix: NONE
Architecture: Little Endian; 32-bit
VerboseLogging: 0
WindowsError: The system cannot find the file specified.
WindowsErrorCode: 0x2
win32CreateFileAnsi failed.
localFilePath: PGexcel.csv
currentWorkingDirectory: \Windows
localWindowsFilePath: PGexcel.csv
Failed.
--LoadFile
--ChilkatLog
If writing Windows Store apps, you'll want to learn more about read/writing/managing files in general. To get your application's data folder, do something like this:
StorageFolder folder = ApplicationData.Current.LocalFolder; string csvPath = folder.Path + @"\PGexcel.csv";