Title: | Helper functions to interact with the ICES sharepoint |
---|---|
Description: | Helper functions to interact with the ICES sharepoint used by the International Council for the Exploration of the Sea (ICES). |
Authors: | Colin Millar [aut, cre], Arni Magnusson [aut] |
Maintainer: | Colin Millar <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.0.9000 |
Built: | 2024-11-01 11:17:49 UTC |
Source: | https://github.com/ices-tools-prod/icesSharePoint |
Set and get SharePoint working directory and site.
setspwd(directory) getspwd() setspsite(site) getspsite()
setspwd(directory) getspwd() setspsite(site) getspsite()
directory |
a directory name. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
getspwd returns an absolute filepath representing the current SharePoint working directory within the current site; setspwd(directory) is used to set the working directory to directory.
Check out the file first to prevent other users from changing it. Then, check it back in after you've made your changes.
spcheckout(file, directory, site, site_collection) spundocheckout(file, directory, site, site_collection) spcheckin(comment, file, directory, site, site_collection)
spcheckout(file, directory, site, site_collection) spundocheckout(file, directory, site, site_collection) spcheckin(comment, file, directory, site, site_collection)
file |
a name of a file on sharepoint. |
directory |
a directory name. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. |
comment |
the checkin comment |
invisibly returns the response from the SharePoint server
spfile.create
To upload a file.
Create and delete folders on the SharePoint system.
spdir.create(folder, directory, site, site_collection) spdir.delete(folder, directory, site, site_collection)
spdir.create(folder, directory, site, site_collection) spdir.delete(folder, directory, site, site_collection)
folder |
a name of a folder on sharepoint. |
directory |
a directory name. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively |
invisibly returns the response from the SharePoint server
spfile.create, spfile.delete
To upload a file and delete files.
Create and delete files on the SharePoint system.
spfile.create(file, con, directory, site, site_collection, text = "") spfile.delete(file, directory, site, site_collection)
spfile.create(file, con, directory, site, site_collection, text = "") spfile.delete(file, directory, site, site_collection)
file |
a name of a file on sharepoint. |
con |
a file connection to, or the file name of, the file to upload. |
directory |
a directory name. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. |
text |
if 'con' is not supplied, the 'text' is assummed to be the contents of the file, defaulting to "". |
invisibly returns the response from the SharePoint server
spcheckout
To upload a file.
List the files and folders in a SharePoint directory.
spfolders(directory = "", site, site_collection, full = FALSE) spfiles(directory = "", site, site_collection, full = FALSE) spdir(directory = "", site, site_collection, recursive = FALSE, full = FALSE)
spfolders(directory = "", site, site_collection, full = FALSE) spfiles(directory = "", site, site_collection, full = FALSE) spdir(directory = "", site, site_collection, recursive = FALSE, full = FALSE)
directory |
a directory name. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. |
full |
a logical value. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned. |
recursive |
logical. Should the listing recurse into directories? |
A character vector containing the names of the files in the specified directories, or "" if there were no files. If a path does not exist or is not a directory or is unreadable it is skipped, with a warning..
setspwd, getspwd
set and get SharePoint working directory.
setspsite, getspsite
set and get SharePoint default site.
## Not run: spfolders() spfiles() spdir() spdir(site = "/ExpertGroups/WGNSSK") ## End(Not run)
## Not run: spfolders() spfiles() spdir() spdir(site = "/ExpertGroups/WGNSSK") ## End(Not run)
Implement a GET request for a given uri.
spget(uri)
spget(uri)
uri |
an api request. |
The requests always ask for json data, but may on occasion (esp when the request fails) return xml.
The result of the request.
Download file from sharepoint and return file location.
spgetfile(file, site, site_collection, destdir = dirname(file))
spgetfile(file, site, site_collection, destdir = dirname(file))
file |
a name of a file on sharepoint. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. |
destdir |
a relative path of the directory to download the file to. |
The path of the downloaded file
Get a json list of information about the currently logged in user.
spgetuser(site, site_collection)
spgetuser(site, site_collection)
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. |
The path of the downloaded file
Implement a POST request for a given uri.
sppost(uri, ...)
sppost(uri, ...)
uri |
an api request. |
... |
additional arguments to POST. |
The requests always ask for json data, but may on occasion (esp when the request fails) return xml.
The result of the request - often there is not response from a POST.
Implement a REST API request. This function wraps up an API request into single uri and calls it
spservice(service, site, site_collection)
spservice(service, site, site_collection)
service |
an api request. |
site |
a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'. The default is to take the value of getOption("icesSharePoint.site"). |
site_collection |
a SharePoint site collection, will almost exclusively be 'https://community.ices.dk', so these functions should work for other SharePoint sites outside ICES. The default is to take the value of getOption("icesSharePoint.site_collection"). |
The requests always ask for json data, but may on occasion (esp when the request fails) return xml.
The result of the request.
## Not run: x <- spservice("sitegroups/getbyname('ICES%20staff')/Users") cbind(sapply(x$results, "[[", "Title"), sapply(x$results, "[[", "Email")) ## End(Not run)
## Not run: x <- spservice("sitegroups/getbyname('ICES%20staff')/Users") cbind(sapply(x$results, "[[", "Title"), sapply(x$results, "[[", "Email")) ## End(Not run)