Learn R Programming

redcapAPI (version 2.8.0)

createFileRepositoryFolder: Create a Folder in the File Repository

Description

This method enables the user to create a folder in the file repository. The folder created may also be a subfolder of an existing folder.

Usage

createFileRepositoryFolder(
  rcon,
  name,
  folder_id = numeric(0),
  dag_id = numeric(0),
  role_id = numeric(0),
  ...
)

# S3 method for redcapApiConnection createFileRepositoryFolder( rcon, name, folder_id = numeric(0), dag_id = numeric(0), role_id = numeric(0), ..., refresh = TRUE, error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Value

Returns a data frame with the columns

folder_idThe REDCap assigned ID value for the newly created folder.
nameThe name assigned to the folder by the user.

Arguments

rcon

A redcapConnection object.

name

character(1) The name of the folder. If a folder by this name already exists, no action will be taken.

folder_id

integerish(0/1). The ID of the parent folder. When length is 0, the new folder is placed in the top-level.

dag_id

integerish(0/1) The ID of a data access group. When provided, access to the folder will be restricted to the DAG.

role_id

integerish(0/1) The ID of a role. When provided, access to the folder will be restricted to users with that role.

...

Arguments to pass to other methods

refresh

logical(1) When TRUE (default), the cached File Repository data on rcon will be refreshed.

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.

See Also

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

Examples

Run this code
if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
# Create a folder in the top-level directory
createFileRepositoryFolder(rcon, 
                           name = "New Folder Name")
                           
# Create a folder in a subfolder
createFileRepositoryFolder(rcon, 
                           name = "New Folder Name", 
                           folder_id = 12345)
                           
# Create a folder assigned to a Data Access Group
createFileRepositoryFolder(rcon, 
                           name = "New Folder Name", 
                           dag_id = 678)
}

  

Run the code above in your browser using DataLab