Package 'icesSharePoint'

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

Help Index


Helper functions to interact with the ICES sharepoint.

Description

Helper functions to download files from the ICES sharepoint.

Author(s)

Colin Millar and Arni Magnusson.

References

ICES Sharepoint site: https://community.ices.dk/SitePages/Home.aspx.


Working Directory and Site

Description

Set and get SharePoint working directory and site.

Usage

setspwd(directory)

getspwd()

setspsite(site)

getspsite()

Arguments

directory

a directory name.

site

a SharePoint site name, e.g. '/ExpertGroups/WGNSSK'.

Value

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-in and Check-out Files

Description

Check out the file first to prevent other users from changing it. Then, check it back in after you've made your changes.

Usage

spcheckout(file, directory, site, site_collection)

spundocheckout(file, directory, site, site_collection)

spcheckin(comment, file, directory, site, site_collection)

Arguments

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

Value

invisibly returns the response from the SharePoint server

See Also

spfile.create To upload a file.


Create and delete folders

Description

Create and delete folders on the SharePoint system.

Usage

spdir.create(folder, directory, site, site_collection)

spdir.delete(folder, directory, site, site_collection)

Arguments

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

Value

invisibly returns the response from the SharePoint server

See Also

spfile.create, spfile.delete To upload a file and delete files.


Create and delete files

Description

Create and delete files on the SharePoint system.

Usage

spfile.create(file, con, directory, site, site_collection, text = "")

spfile.delete(file, directory, site, site_collection)

Arguments

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 "".

Value

invisibly returns the response from the SharePoint server

See Also

spcheckout To upload a file.


Files and Folders

Description

List the files and folders in a SharePoint directory.

Usage

spfolders(directory = "", site, site_collection, full = FALSE)

spfiles(directory = "", site, site_collection, full = FALSE)

spdir(directory = "", site, site_collection, recursive = FALSE, full = FALSE)

Arguments

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?

Value

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..

See Also

setspwd, getspwd set and get SharePoint working directory.

setspsite, getspsite set and get SharePoint default site.

Examples

## Not run: 
spfolders()
spfiles()
spdir()

spdir(site = "/ExpertGroups/WGNSSK")

## End(Not run)

Basic GET request from SharePoint

Description

Implement a GET request for a given uri.

Usage

spget(uri)

Arguments

uri

an api request.

Details

The requests always ask for json data, but may on occasion (esp when the request fails) return xml.

Value

The result of the request.


Download Files from SharePoint

Description

Download file from sharepoint and return file location.

Usage

spgetfile(file, site, site_collection, destdir = dirname(file))

Arguments

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.

Value

The path of the downloaded file


Get Current User Information

Description

Get a json list of information about the currently logged in user.

Usage

spgetuser(site, site_collection)

Arguments

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.

Value

The path of the downloaded file


Basic POST request from SharePoint

Description

Implement a POST request for a given uri.

Usage

sppost(uri, ...)

Arguments

uri

an api request.

...

additional arguments to POST.

Details

The requests always ask for json data, but may on occasion (esp when the request fails) return xml.

Value

The result of the request - often there is not response from a POST.


REST API request from SharePoint

Description

Implement a REST API request. This function wraps up an API request into single uri and calls it

Usage

spservice(service, site, site_collection)

Arguments

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").

Details

The requests always ask for json data, but may on occasion (esp when the request fails) return xml.

Value

The result of the request.

Examples

## Not run: 
 x <- spservice("sitegroups/getbyname('ICES%20staff')/Users")
cbind(sapply(x$results, "[[", "Title"),
      sapply(x$results, "[[", "Email"))

## End(Not run)