
Connector Object for Sharepoint class, built on top of connector::Connector class
Source:R/sharepoint.R
ConnectorSharepoint_object.Rd
This object is used to interact with Sharepoint, adding the ability to list, read, write, download, upload, create directories and remove files.
Super classes
connector::Connector
-> connector::ConnectorFS
-> ConnectorSharepoint
Methods
Inherited methods
connector::Connector$list_content_cnt()
connector::Connector$print()
connector::Connector$read_cnt()
connector::Connector$remove_cnt()
connector::Connector$write_cnt()
connector::ConnectorFS$create_directory_cnt()
connector::ConnectorFS$download_cnt()
connector::ConnectorFS$remove_directory_cnt()
connector::ConnectorFS$tbl_cnt()
connector::ConnectorFS$upload_cnt()
Method new()
Initializes the ConnectorSharepoint class
Usage
ConnectorSharepoint$new(
site_url,
token = get_token(),
path_of_folder = NULL,
...,
extra_class = NULL
)
Arguments
site_url
The URL of the Sharepoint site
token
The Azure token. By default, it will be retrieve by get_token
path_of_folder
The path of the folder to interact with, if you don't want to interact with the root folder "Documents"
...
Additional parameters to pass to the get_sharepoint_site function
extra_class
character Extra class added to the object.
Method upload_directory_cnt()
Upload a folder
Usage
ConnectorSharepoint$upload_directory_cnt(
folder,
name = basename(folder),
...,
recursive = FALSE
)
Arguments
folder
Local folder path
name
Folder name to be used when uploaded
...
additional paramaeters passed on to
upload_folder()
method ofMicrosoft365R::ms_drive()
class or toupload()
method ofMicrosoft365R::ms_drive_item()
class.recursive
If
recursive
isTRUE
, all subfolders will also be transferred recursively. Default:FALSE
Examples
if (FALSE) { # not_on_ci()
# Connect to Sharepoint
cs <- ConnectorSharepoint$new(
site_url = Sys.getenv("SHAREPOINT_SITE_URL")
)
cs
# List content
cs$list_content_cnt()
# Write to the connector
cs$write_cnt(iris, "iris.rds")
# Check it is there
cs$list_content_cnt()
# Read the result back
cs$read_cnt("iris.rds") |>
head()
# Remove a file or directory
cs$remove_cnt("iris.rds")
# Check it is there
cs$list_content_cnt()
}