Skip to content

Files

Latest commit

8064828 · Feb 24, 2020

History

History

trash-search-automation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 24, 2020
Feb 24, 2020

Trash Search Automation Script

The Trash Search automation script contains an examples to help search for files within a service account or admin's trash.

Rationale

When creating a closed folder structure in Box, a service account or admin account will often own an entire departmental or personal folder hierarchy. Since the user owns all of the content any type of administrative activity to find trashed files associated with a specific user becomes laborious manual task.

Examples

  1. Search Trash and Filter by File Name: A PowerShell function to search for a specific term in the service account or admin's trash and to find a PARTIAL match on the file name. Then optionally, restore the file and move it to a target parent folder.
  2. Search Trash and Filter by File Name and Created By Login: A PowerShell function to search for a specific term in the service account or admin's trash and to find a PARTIAL match on the file name AND an EXACT match on the created_by login email address. Then optionally, restore the file and move it to a target parent folder.

Pre-Requisites

  1. Ensure you've completed pre-requisites in the parent project documentation
  2. OPTIONAL: Set the AsUserId variable.
  3. Set the ItemName variable.
  4. Set the CreatedByLogin variable.
  5. Set the RestoreFile variable to $true or $false depending on if you would like to restore the files and move them to a target parent folder.
box folders:create 0 eDiscoFolder-123
  1. Set the CsvReportPath variable to the local directory in which to create the CSV report.
  2. Uncomment Search-Trashed-Items-By-FileName to enable the search by file name example.
  3. Uncomment Search-Trashed-Items-By-FileName-And-CreatedBy to enable the search by file name and created by login example.
  4. If running on macOS, enable a powershell session by executing the pwsh commmand.
  5. Run the example...
PS box-powershell-automations/trash-search-automation> ./trash-search-automation.ps1                       
Searching trashed items by name and created_by.login...
Using offset: 0
Found response body: @{total_count=996; entries=System.Object[]; limit=100; offset=0}
Found total count: 996

Disclaimer

This project is a collection of open source examples and should not be treated as an officially supported product. Use at your own risk. If you encounter any problems, please log an issue.

License

The MIT License (MIT)

Copyright (c) 2020 Kyle Adams

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.