'Reading Onedrive file to R

This question is VERY similar to this one: Reading OneDrive files to R

But with a slight twist:

I have an R script that opens a connection to a database. This is roughly that code (names changed to protect the innocent):

jdbcDriver <- JDBC(driverClass="oracle.jdbc.driver.OracleDriver", classPath="C:/Users/JohnDoe/OneDrive - Job Corporation/Documents/Data/jar files/ojdbc8.jar")  
jdbcConnection <- dbConnect(jdbcDriver, "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=place.company.com)(PORT=1234))(CONNECT_DATA=(SERVICE_NAME=ghjed)))", "abc_thing_prod_ro4", "AKabc$VxqcasdfdsTDYjZsadfcdy-pxEUW")  

As you can see, in that first line I link to the location of a ".jar" file that the code needs. Its already in my OneDrive, and because my onedrive is locally mapped to me, this code works great and opens a connection.

The problem is I need to be able to share this R code with other people, and have the code still work when run on their computer. (and really, ultimately, all this R code is actually run inside of a powerBI file). So in other words, I think I'd like to have a line of code that would read in/download the file from OneDrive so it could be run on other computers.

In this solution to that other question, it looks like it would do roughly that. It looks like his answer would download a csv that was on onedrive and had been linked to, but the problem one commenter pointed out was that "if you are using OneDrive for Business and your admin has disabled the use of public file sharing via links" it will not work. Well, thats exactly my case.

That being said the only people who'd be running this code are within my organization and ARE allowed to download from onedrive links I share. When I just tried to run the solutions code as-is I get an error of "http status was '403 forbidden'

Am I just plain out of luck? Is there a way to get R to read from a onedrive link (when run on other computers) if our admin doesnt like public link sharing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source