ms_site: Office 365 SharePoint site

ms_siteR Documentation

Office 365 SharePoint site

Description

Class representing a SharePoint site.

Format

An R6 object of class ms_site, inheriting from ms_object.

Fields

  • token: The token used to authenticate with the Graph host.

  • tenant: The Azure Active Directory tenant for this site.

  • type: always "site" for a site object.

  • properties: The site properties.

Methods

  • new(...): Initialize a new site object. Do not call this directly; see 'Initialization' below.

  • delete(confirm=TRUE): Delete a site. By default, ask for confirmation first.

  • update(...): Update the site metadata in Microsoft Graph.

  • do_operation(...): Carry out an arbitrary operation on the site.

  • sync_fields(): Synchronise the R object with the site metadata in Microsoft Graph.

  • list_drives(filter=NULL, n=Inf): List the drives (shared document libraries) associated with this site.

  • get_drive(drive_name, drive_id): Retrieve a shared document library for this site. If the name and ID are not specified, this returns the default document library.

  • list_subsites(filter=NULL, n=Inf): List the subsites of this site.

  • get_lists(filter=NULL, n=Inf): Returns the lists that are part of this site.

  • get_list(list_name, list_id): Returns a specific list, either by name or ID.

  • get_group(): Retrieve the Microsoft 365 group associated with the site, if it exists. A site that backs a private Teams channel will not have a group associated with it.

Initialization

Creating new objects of this class should be done via the get_sharepoint_site method of the ms_graph or az_group classes. Calling the new() method for this class only constructs the R object; it does not call the Microsoft Graph API to retrieve or create the actual site.

List methods

All ⁠list_*⁠ methods have filter and n arguments to limit the number of results. The former should be an OData expression as a string to filter the result set on. The latter should be a number setting the maximum number of (filtered) results to return. The default values are filter=NULL and n=Inf. If n=NULL, the ms_graph_pager iterator object is returned instead to allow manual iteration over the results.

Support in the underlying Graph API for OData queries is patchy. Not all endpoints that return lists of objects support filtering, and if they do, they may not allow all of the defined operators. If your filtering expression results in an error, you can carry out the operation without filtering and then filter the results on the client side.

See Also

ms_graph, ms_drive, az_user

Microsoft Graph overview, SharePoint sites API reference

Examples

## Not run: 

site <- get_sharepoint_site("My site")
site$list_drives()
site$get_drive()


## End(Not run)

Microsoft365R documentation built on May 31, 2023, 6:10 p.m.