Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using R to connect to a sharepoint list

Has anyone been able to import a SharePoint list in R as a dataframe?

I have two separate data sources, one from a SharePoint list and the other from a DB that I wish to run an analysis on. I am able to connect to the DB without any problem but can't seem to find anything to connect to a SharePoint list.

The SharePoint server is 2007

like image 896
John Smith Avatar asked Mar 01 '15 10:03

John Smith


1 Answers

I've been working on reading SharePoint 2010 lists using R for a little while now. Basically, I use the SharePoint web service to return the results from the list, then use xmlToDataFrame to convert to a dataframe.

URL <- "http://yoursharepointserver/_vti_bin/ListData.svc/yourlist"    
data = xmlParse(readLines(URL))

## get the individual list items    
items = getNodeSet(data, "//m:properties")

## convert to a data frame
df = xmlToDataFrame(items, stringsAsFactors = FALSE)

Since I'm using the web service I can filter the list before I return the results, which is really helpful in overcoming the limitations of the SharePoint web service. The following link is quite helpful... http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/21/introduction-to-querying-lists-with-rest-and-listdata-svc-in-sharepoint-2010.aspx

like image 108
Lee Mendoza Avatar answered Sep 17 '22 13:09

Lee Mendoza