Copy file to sharepoint library in R

I am trying to copy files from a network drive to the sharepoint library in R. To host the sharepoint library, user authentication is required, and I was wondering how I can copy these files and authenticate in code. A simple .copy file does not work. I tried to use a function getURL()from the library RCurl, but that didn't work either. I was wondering how I can accomplish this task - copying files while transmitting authentication.

Here are some code snippets I've tried so far:

library(RCurl)
from <- "filename"
to <- "\\\\sharepoint.company.com\\Directory" #First attempt with just sharepoint location
to <- "file://sharepoint.company.com/Directory" #Another attempt with different format
h = getCurlHandle(header = TRUE, userpwd = "username:password")
getURL(to, verbose = TRUE, curl = h)
status <- file.copy(from, to)

Thank!

+5
source share
3 answers

, SharePoint, .

setwd(), , . Sharepoint, , / .

+2

SharePoint. , , , , .

 saveToSharePoint <- function(fileName) 
   { 
     cmd <- paste("curl --max-time 7200 --connect-timeout 7200 --ntlm --user","username:password", 
              "--upload-file /home/username/FolderNameWhereTheFileToTransferExists/",fileName, 
              "teamsites.OrganizationName.com/sites/PageTitle/Documents/UserDocumentation/FolderNameWhereTheFileNeedsToBeCopied/",fileName, sep = " ")
     system(cmd)
   } 

 saveToSharePoint("SomeFileName.Ext")
0

SharePoint , " " ( ). oneDrive .

0

All Articles