ms_object {AzureGraph}R Documentation

Microsoft Graph object

Description

Base class representing a object in Microsoft Graph. All other Graph object classes ultimately inherit from this class.

Format

An R6 object of class ms_object.

Fields

Methods

Initialization

Objects of this class should not be created directly. Instead, create an object of the appropriate subclass.

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.

Paged results

Microsoft Graph returns lists in pages, with each page containing a subset of objects and a link to the next page. AzureGraph provides an iterator-based API that lets you access each page individually, or collect them all into a single object.

To create a new pager object, call the get_list_pager() method with the following arguments:

This returns an object of class ms_graph_pager, which is an iterator for the set of paged results. Each call to the object's value active binding yields the next page. When all pages have been returned, value contains NULL.

The format of the returned values can take one of 3 forms, based on the initial format of the first page and the generate_objects argument.

If the first page of results is a data frame (each item has been converted into a row), then the pager will return results as data frames. In this case, the output field is automatically set to "data.frame" and the generate_objects initialization argument is ignored. Usually this will be the case when the results are meant to represent external data, eg items in a SharePoint list.

If the first page of results is a list, the generate_objects argument sets whether to convert the items in each page into R6 objects defined by the AzureGraph class framework. If generate_objects is TRUE, the output field is set to "object", and if generate_objects is FALSE, the output field is set to "list".

You can also call the extract_list_values() function to get all or some of the values from a pager, without having to manually combine the pages together.

Deprecated methods

The following methods are private and deprecated, and form the older AzureGraph API for accessing paged results. They will eventually be removed.

See Also

ms_graph, az_object, ms_graph_pager, extract_list_values

Microsoft Graph overview, REST API reference


[Package AzureGraph version 1.3.4 Index]