Firstly, before anyone marks this question as a duplicate, read this. I read through many questions that are potential duplicates of this one, like this, yet none of the solutions that seemed applicable in my situation worked for me.
So, I have some code below to save text to a file (note: all variables have already been defined):
await Task.Run(() => File.WriteAllText(documentFile.Path, documentToSave));
But then, the a System.UnauthorisedAccessException
is thrown at that line.
How can I fix this? Any solutions would be appreciated! Thanks in advance!