An R6 Class to interface CDC Sharepoint sites
An R6 Class to interface CDC Sharepoint sites
Methods
Method new()
Create a new Sharepoint Site connection
Usage
spoConnection$new(
tenant,
client_id,
client_secret,
teams_name,
default_library = "Shared Documents"
)
Arguments
tenant
(character) An Azure tenant string
client_id
(character) A Client ID for the App Registration
client_secret
(character) A Client Secret for the App Registration
teams_name
(character) Either a MS Teams name or Sharepoint site name
default_library
(character, default: "Shared Documents") The document library to connect to
Returns
A new spoConnection
object
Method read_file()
Read in a file from Sharepoint Site
Usage
spoConnection$read_file(relative_url, ...)
Arguments
relative_url
File path relative to the "Documents" folder
...
other named parameters passed to a read in function
Returns
If Excel or CSV file, a data frame. All other types will return error
Method list_files()
List files in a Teams / Sharepoint Folder
Usage
spoConnection$list_files(relative_url)
Arguments
relative_url
(character) a folder URL relative to the "Shared Documents" folder
Returns
A character vector of files present in the folder
Method get_list()
Pull a Sharepoint List from an MS Teams/Sharepoint Site
Usage
spoConnection$get_list(list_name)
Arguments
list_name
(character) Name of the Sharepoint list
Returns
Possibly a data.frame of the sharepoint list
Method write_file()
Write a local file to a MS Teams/Sharepoint Site
Usage
spoConnection$write_file(x, relative_url)
Arguments
x
(character) Local path to the file to write
relative_url
(character) Destination path where the file should be written to
Returns
URL path linking to the newly created file
Method clone()
The objects of this class are cloneable with this method.
Usage
spoConnection$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.