ms_graph_pager {AzureGraph}R Documentation

Pager object for Graph list results

Description

Class representing an iterator for a set of paged query results.

Format

An R6 object of class ms_graph_pager.

Fields

Methods

Active bindings

Initialization

The recommended way to create objects of this class is via the ms_object$get_list_pager() method, but it can also be initialized directly. The arguments to the new() method are:

Value

The value active binding returns the page values for each iteration of the pager. This 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".

See Also

ms_object, extract_list_values

Microsoft Graph overview, Paging documentation

Examples

## Not run: 

# list direct memberships
firstpage <- call_graph_endpoint(token, "me/memberOf")

pager <- ms_graph_pager$new(token, firstpage)
pager$has_data()
pager$value

# once all the pages have been returned
isFALSE(pager$has_data())
is.null(pager$value)

# returning items, 1 per page, as raw lists of properties
firstpage <- call_graph_endpoint(token, "me/memberOf", options=list(`$top`=1))
pager <- ms_graph_pager$new(token, firstpage, generate_objects=FALSE)
lst <- NULL
while(pager$has_data())
    lst <- c(lst, pager$value)

# returning items as a data frame
firstdf <- call_graph_endpoint(token, "me/memberOf", options=list(`$top`=1),
                               simplify=TRUE)
pager <- ms_graph_pager$new(token, firstdf)
df <- NULL
while(pager$has_data())
    df <- vctrs::vec_rbin(df, pager$value)


## End(Not run)

[Package AzureGraph version 1.3.4 Index]