将文件复制到R中的sharepoint库

abh*_*han 6 authentication r

我正在尝试将文件从网络驱动器位置复制到R中的sharepoint库.共享点库位置需要用户身份验证,我想知道如何复制这些文件并在代码中传递身份验证.一个简单的file.copy不起作用.我试图使用库中的getURL()函数RCurl但是也没有用.我想知道如何完成这项任务 - 在通过身份验证时复制文件.

以下是我到目前为止尝试过的一些代码片段:

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)
Run Code Online (Sandbox Code Playgroud)

谢谢!

小智 3

这不是最优雅的解决方案,但如果您希望保存到 SharePoint 上的单个库中,您可以首先将该库映射为本地计算机上的驱动器。

只需使用setwd()指向您将库映射到的任何驱动器号即可。然后,您可以将该 Sharepoint 库视为任何其他共享驱动器位置,并从中读取和写入文件。