Skip to content

Attachments Report

Stevan Freeborn edited this page Apr 15, 2024 · 7 revisions

This command is intended to help Onspring customers report on the attachments contained within an Onspring app. The command will produce a report in the form of a .csv file that contains information about each attachment in the app.

General Usage

When executing the command you will need to provide it with a Source Api Key and an App Id which the app will use to report on the attachments contained within the app that corresponds to the given App Id.

These pieces of information need to be provided as command-line arguments.

onspringcli.exe attachments report -sk 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000 -a 100

Notes:

  • Source Api Key can be obtained as outlined in this repository's README.md API Key section.
  • App Id can be obtained...
    • by using the Onspring API's /Apps endpoint
    • by looking at the url of the app in your browser. i.e. https://instance.onspring.com/Admin/App/134

Options

This command currently has a number of options that can be passed as command-line arguments to alter the behavior of the command. These can be viewed by passing the -h or --help option to the command.

  • App Id: --app-id or -a
    • Allows you to specify an App Id to report on.
    • Example usage: onspringcli.exe attachments report -a 100
  • Output Directory: --output-directory or -o
    • Allows you to specify the name of the folder the report should be written in.
    • Example usage: onspringcli.exe attachments report -o report_folder
  • Files Filter: --files-filter or -ff
    • Allows you to specify what files to include in the report by providing a comma separated list of file ids.
    • Note files with ids not included in the provided list will not be included in the report.
    • Example usage: onspringcli.exe attachments report -ff 1,2,3
  • Files Filter Csv: --files-filter-csv or -ffcsv
    • Allows you to specify what files to include in the report by providing a path to a .csv file that contains a list of file ids.
    • Note files with ids not included in the provided .csv file will not be included in the report.
    • Note your csv file should NOT contain a header row.
    • Example usage: onspringcli.exe attachments report -ffcsv files.csv

Note: These are in addition to the Global Options detailed in this repository's README.md.

Output

Each time this command is executed it will generate a folder that is named according to the output directory name specified or if not specified it will be named by default output. All files generated by the command during the run will be saved into this folder.

Example Output Folder Name:

output

Report

The command will generate a report that contains information about the attachments that were found in the app. This report will be saved to the output folder as a .csv file. The report will contain the following information about each attachment:

  • Record Id: The id of the record that the attachment is attached to.
  • Field Id: The id of the field that the attachment is attached to.
  • Field Name: The name of the field that the attachment is attached to.
  • File Id: The id of the file.
  • File Name: The name of the file.
  • File Size: The size of the file in bytes.
  • File Size (KB): The size of the file in kilobytes.
  • File Size (KiB): The size of the file in kibibytes (1024 bytes).
  • File Size (MB): The size of the file in megabytes.
  • File Size (MiB): The size of the file in mebibytes (1024 kibibytes).
  • File Size (GB): The size of the file in gigabytes.
  • File Size (GiB): The size of the file in gibibytes (1024 mebibytes).

Note: If the app encounters an error retrieving a files information it will be logged to the log file. And an entry will be made into the csv file for the record with the file name replaced with the text Error: Unable to get file info and the file size set to zero. If you want to attempt to request these specific files again you should be able to use the Files Filter Csv option to provide these files' ids in a .csv to the command and it will only attempt to retrieve information for those files.

Clone this wiki locally