SP: SP

Description Usage Arguments Details Value Examples

View source: R/msapi.R

Description

Simple, flexible REST API calls to MS SharePoint.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SP(
  query = "",
  Username = "",
  Method = "GET",
  acceptLanguage = "en",
  reenterPassword = FALSE,
  refreshTokens = FALSE,
  tokens_timeout_in_hours = "3",
  ...
)

Arguments

query

The full URL for the query to send to the MS Office Graph or SharePoint API

Username

Your email for authentication on the SharePoint server

Method

Defaults to GET but also supports POST. MERGE support hasn't been written in yet.

acceptLanguage

Defaults to en

reenterPassword

Option to manually clear your password

refreshTokens

Option to manually clear all tokens, for example, to connect from a different user account

tokens_timeout_in_hours

Set number of hours before new tokens will be requested. The default is 3, but regardless, new token requests will be handled as needed automatically.

Details

This function allows R to send normally constructed SharePoint queries and return the response as a simple data.frame.

For more information about how to construct queries, see the SharePoint REST API documentation: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints

To further refine your queries, see the OData documentation: https://www.odata.org/documentation/

Value

A data.frame with the complete, pagerized response to your query.

Examples

1
2
3
4
5
6
ListItems <- SP("https://{YOUR TENANT}.sharepoint.com/sites/_api/Web/Lists(guid'{THE ID OF YOUR LIST}')/Items", Username = "{YOUR AUTHENTICATION EMAIL}")


You can use pipes for a clearer view of your queries:

ListItems <- "https://{YOUR TENANT}.sharepoint.com/sites/_api/Web/Lists(guid'{THE ID OF YOUR LIST}')/Items" %>% SP(Username = "{YOUR AUTHENTICATION EMAIL}")

brendan-newlon/msapi documentation built on April 20, 2020, 1:57 a.m.