exportFileRepositoryListing: Export a Listing of Folders and Files in the File Repository

View source: R/exportFileRepositoryListing.R

exportFileRepositoryListingR Documentation

Export a Listing of Folders and Files in the File Repository

Description

This method enables the user to export a list of folders and files saved to the File Repository. The listing may optionally include contents of subfolders.

Usage

exportFileRepositoryListing(
  rcon,
  folder_id = numeric(0),
  recursive = FALSE,
  ...
)

## S3 method for class 'redcapApiConnection'
exportFileRepositoryListing(
  rcon,
  folder_id = numeric(0),
  recursive = FALSE,
  ...,
  error_handling = getOption("redcap_error_handling"),
  config = list(),
  api_param = list()
)

Arguments

rcon

A redcapConnection object.

folder_id

integerish(0/1). The folder ID of a specific folder in the File Repository for which a list of files and subfolders will be exported. By default, the top-level directory of the File Repository will be used.

recursive

logical(1). When TRUE, content of subfolders will be retrieved until a full listing is produced. If FALSE, only the contents of the requested folder will be returned.

...

Arguments to pass to other methods

error_handling

character(1). One of c("error", "null"). An option for how to handle errors returned by the API. see redcapError().

config

A named list. Additional configuration parameters to pass to httr::POST(). These are appended to any parameters in rcon$config.

api_param

A named list. Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

Value

Returns a data frame with the columns

folder_id The REDCap assigned ID value for the folder. Will be NA if the item is a file.
doc_id The REDCap assigned ID value for the file. Will be NA if the item is a folder.
name The name of the folder of file.
parent_folder The ID of the parent folder of the item. The top-level folder is represented as 0.

See Also

exportFromFileRepository(),
importToFileRepository(),
deleteFromFileRepository(),
exportFileRepository(),
importFileRepository(),
deleteFileRepository(),
createFileRepositoryFolder()

Examples

## Not run: 
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
# Export the top-level listing of the File Repository
exportFileRepositoryListing(rcon)

# Export the complete listing of the File Repository
exportFileRepositoryListing(rcon, 
                            recursive = TRUE)
                            
# Export the listing of a subfolder in the File Repository
exportFileRepositoryListing(rcon, 
                            folder_id = 12345)

## End(Not run)


nutterb/redcapAPI documentation built on Feb. 11, 2024, 11:20 p.m.