使用 Windows 身份验证访问 R 中的共享点 [英] Accessing sharepoint in R with windows authentication

查看:49
本文介绍了使用 Windows 身份验证访问 R 中的共享点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我公司的 Intranet 共享点读取数据.

require(httr)url <- "http://<域>/<路径>/_vti_bin/ListData.svc/<某事>"r <- GET(url)

问题是,对 Sharepoint 的访问使用 Windows 身份验证.预计上述内容给了我 401 Unauthorized 错误.

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

解决方案

按照概述获取您的站点 ID 此处.按照概述获取您的列表 ID 这里.如果您需要展开任何列表项,请检查 这个出来.

<块引用>

为了确保您不会像我一样脱发和秃顶,请确保您在 SharePoint 网站中的项目级读取权限设置为读取所有项目".(这里是参考).

库(AzureGraph)gr <- create_graph_login()我 <- gr$get_user("me")url <- "https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items"r <- call_graph_url(me$token, url, http_verb = c(GET"))

I am trying to read data from my company intranet sharepoint.

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

The problem is, access to Sharepoint uses Windows authentication. The above, expectedly, gave me 401 Unauthorized error.

How can I incorporate my windows authentication into the request in R, without typing my credential in clear text in the GET parameter? (using authenticate() with my credentials do work).

解决方案

Get your site-id as outlined here. Get your list-id as outlined here. If you need to expand any list items, check this out.

And to make sure you don't pull your hair out and go bald like me, make sure that your item-level permissions for read access in the SharePoint site are set to "Read all items" (here's a reference).

library(AzureGraph)

gr <- create_graph_login()
me <- gr$get_user("me")
url <- "https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items"
r <- call_graph_url(me$token, url, http_verb = c("GET"))

这篇关于使用 Windows 身份验证访问 R 中的共享点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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