Skip to contents

get_sp_site() is a wrapper for Microsoft365R::get_sharepoint_site() and returns a ms_site object. cache_sp_site() allows you to cache a default SharePoint site for use by other functions.

Usage

get_sp_site(
  site_url = NULL,
  site_name = NULL,
  site_id = NULL,
  ...,
  cache = FALSE,
  refresh = TRUE,
  overwrite = FALSE,
  cache_file = getOption("sharepointr.cache_file_site", "sp_site.rds"),
  call = caller_env()
)

cache_sp_site(
  ...,
  site = NULL,
  cache_file = getOption("sharepointr.cache_file_site", "sp_site.rds"),
  cache_dir = "sharepointr.cache_dir",
  overwrite = FALSE,
  call = caller_env()
)

Arguments

site_url

A SharePoint site URL in the format "https://[tenant name].sharepoint.com/sites/[site name]". Any SharePoint item or document URL can also be parsed to build a site URL using the tenant and site name included in the URL.

site_name, site_id

Site name or ID of the SharePoint site as an alternative to the SharePoint site URL. Exactly one of site_url, site_name, and site_id must be supplied.

...

Arguments passed on to Microsoft365R::get_sharepoint_site

app

A custom app registration ID to use for authentication. See below.

scopes

The Microsoft Graph scopes (permissions) to obtain. It should never be necessary to change these.

token

An AAD OAuth token object, of class AzureAuth::AzureToken. If supplied, the tenant, app, scopes and ... arguments will be ignored. See "Authenticating with a token" below.

tenant

For get_business_onedrive, get_sharepoint_site and get_team, the name of your Azure Active Directory (AAD) tenant. If not supplied, use the value of the CLIMICROSOFT365_TENANT environment variable, or "common" if that is unset.

cache

If TRUE, cache site to a file using cache_sp_site().

refresh

If TRUE, get a new site even if the existing site is cached as a local option. If FALSE, use the cached ms_site object.

overwrite

If TRUE, replace the existing cached object named by cache_file with the new object. If FALSE, error if a cached file with the same cache_file name already exists.

cache_file

File name for cached file if cache = TRUE. Defaults to "sp_site.rds" or option set with sharepointr.cache_file_site.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.

site

A ms_site object. If site is supplied, site_url, site_name, and site_id are ignored.

cache_dir

Cache directory. By default, uses an environmental variable named "sharepointr.cache_dir". If "sharepointr.cache_dir" is not set, the cache directory is set to rappdirs::user_cache_dir("sharepointr").