I've tried all the different ways I could find on Stack Overflow but they all throw 403 Forbidden error. Some of the codes I've tried:
library(RCurl)
webpage <- getURL("https://companyname.sharepoint.com/folder1/folder2/Shared%20Documents/filename.txt", userpwd = "username@companyname.com:mypassword")
tc <- textConnection(webpage)
readLines(tc)
require(httr)
url <- "https://companyname.sharepoint.com/folder1/folder2/Shared%20Documents/filename.csv"
r <- GET(url, authenticate("username@companyname.com","mypassword", type="any"))
library(readxl)
r <- read_excel('https://companyname.sharepoint.com/folder1/folder2/Shared%20Documents/filename.xlsx
', 'Sheet1', skip=1)
They all threw 403. Only exception was when I tried the 2nd example but with type="ntlm"
which threw a 401 error. I'm really at a loss. What am I doing wrong? I've triple checked to make sure my user name and passwords are correct... I know I can sync my local folder to Sharepoint and read from there but my current workflow requires me to read directly from Sharepoint.