使用Windows身份验证访问R中的sharepoint

Ric*_*cky 6 sharepoint r windows-authentication

我正在尝试从我公司的Intranet sharepoint读取数据.

require(httr)
url <- "http://<domain>/<path>/_vti_bin/ListData.svc/<something>"
r <- GET(url)
Run Code Online (Sandbox Code Playgroud)

问题是,访问Sharepoint使用Windows身份验证.以上,预计会给我401 Unauthorized错误.

如何将我的Windows身份验证合并到R中的请求中,而无需在GET参数中以明文形式键入我的凭据?(使用authenticate()我的凭据工作).

小智 2

authenticate()是正确使用的函数,但您需要更改输入,如下所示:

require(httr)
url <- "http://<domain>/<path>/_vti_bin/ListData.svc/<something>"
r <- GET(url, authenticate("username","password",type="any"))
Run Code Online (Sandbox Code Playgroud)

我不确定哪种特定类型有效,但我能够使用任何类型建立会话。我在 httr 包文档中找到了解决方案。

https://cran.r-project.org/web/packages/httr/httr.pdf