将文件复制到R中的Sharepoint库 [英] Copying file to sharepoint library in R

查看:83
本文介绍了将文件复制到R中的Sharepoint库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to copy files from a network drive location to a sharepoint library in R. The sharepoint library location requires user authentication and I was wondering how I can copy these files and pass authentication in code. A simple file.copy does not work. I was attempting to use the getURL() function from RCurl library but that hasn't worked either. I was wondering how I can accomplish this task - copying files while passing authentication.

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

Here are some code snippets that I have 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)

谢谢!

推荐答案

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

Not the most elegant solution but if you're looking to save into a single library on SharePoint, you can first map that library as a drive on your local machine.

只需使用setwd()指向您将库映射到的任何驱动器号.然后,您可以将该Sharepoint库当作其他共享驱动器位置来处理,从该位置读取文件或向其中写入文件.

Simply use setwd() to point to whatever drive letter you mapped the library to. You can then treat that Sharepoint library as if it were any other shared drive location, reading and writing files from/to it.

这篇关于将文件复制到R中的Sharepoint库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆