I would like to access a file system file from within SharePoint, programmatically via script (jQuery AJAX). I didn’t think this would be so difficult, because I do it routinely with, say, $.getJSON() outside of SharePoint, where the file to be opened is in the same directory as the HTML file holding the $.getJSON() call.
I set a folder to be shared universally, gave full control to Everyone, and placed a file there. From the browser, this address works:
\\server\folder\filename
In the script, no version of this or any format I can imagine has returned anything but “File not found.” I even put a file at the root of my IIS site and tried
http://mysite/myfile
but that had no better effect.
I use
$.support.cors=true
so I no longer get the “No Transport” errors that signify cross-domain problems.
I’ve seen statements that this is not possible but have a hard time accepting it, because of other similar successes.
There are two problems that you are running up against:
A better way to do this would be to place your file in a SharePoint Document library. Then you can use the built in SharePoint functionality to read it.