extract_list_values {AzureGraph}R Documentation

Get the list of values from a Graph pager object

Description

Get the list of values from a Graph pager object

Usage

extract_list_values(pager, n = Inf)

Arguments

pager

An object of class ms_graph_pager, which is an iterator for a list of paged query results.

n

The number of items from the list to return. Note this is not the number of pages (each page will usually contain multiple items). The default value of Inf extracts all the values from the list, leaving the pager empty. If this is NULL, the pager itself is returned.

Details

This is a convenience function to perform the common task of extracting all or some of the items from a paged response.

Value

If n is Inf or a number, the items from the paged query results. The format of the returned value depends on the pager settings. This will either be a nested list containing the properties for each of the items; a list of R6 objects; or a data frame. If the pager is empty, an error is thrown.

If n is NULL, the pager itself is returned.

See Also

ms_graph_pager, ms_object, call_graph_endpoint

Examples

## Not run: 

firstpage <- call_graph_endpoint(token, "me/memberOf")
pager <- ms_graph_pager$new(token, firstpage)
extract_list_values(pager)

# trying to extract values a 2nd time will fail
try(extract_list_values(pager))


## End(Not run)

[Package AzureGraph version 1.3.4 Index]