Effortless document location updates and deletions

Version 2.6 March 2024

Introduction

This guide is for users who want to update the Document Searchability database without using Document Searchability UI, either directly or through a background script. You will need to call Aquaforest.Searchlight.DatabaseManager.exe (located in the bin folder where Document Searchability is installed) with the appropriate parameters based on the operation being performed.

Operations

A list of supported operations is described in the following sections.

Update locations

This operation allows you to:

  1. add new locations and optionally delete existing locations before adding

  2. update the authentication of existing locations

Usage

Below is a simplified usage example of all the allowed parameters. Optional parameters are in square brackets.

Aquaforest.Searchlight.DatabaseManager.exe /Operation="UpdateLibraryLocations" /DocumentLibraryID="<ID>" /LocationsTextFile="<PATH>" [<AUTHENTICATION_PARAMS>] [/DeleteExistingLocations] [/ValidateLocations] [/ContinueOnLocationValidationError] [/LogToConsole] [(/LogToFile /LogFilePath="<LOG_PATH>")] [/Debug]

The following is a more detailed usage example with the AUTHENTICATION_PARAMS expanded. The authentication parameters depend on the Library Type of Document Searchability library you are updating.

Aquaforest.Searchlight.DatabaseManager.exe /Operation="UpdateLibraryLocations" /DocumentLibraryID="<ID>" /LocationsTextFile="<PATH>" [{/Username="<USERNAME>" /Password="<PASSWORD>" [(/UseAdfs /AdfsHost="<ADFS_HOST>" /AdfsRelyingPartyIdentifier="<ADFS_IDENTIFIER>")] | /UseModernAuthentication /AzureAppId="<AZURE_APP_ID>" /TenantUrl="<TENANT>" /CertificatePath="<CERT_PATH>" /CertificatePassword="<CERT_PASS>" | /UseAppOnlyAuthentication /ClientId="<CLIENT_ID>" /ClientSecret="<CLIENT_SECRET>" | /AzureStorageAccountName="<STORAGE_ACC_NAME>" /AzureStorageAccountKey="<STORAGE_ACC_KEY>"}] [/DeleteExistingLocations] [/ValidateLocations] [/ContinueOnLocationValidationError] [/LogToConsole] [(/LogToFile /LogFilePath="<LOG_PATH>")] [/Debug]

The following authentication parameters are required based on the Library Type of the Document Searchability library being updated and the authentication required to access the locations being added to the library.

Document Searchability library typeLocation authentication typeRequired parameters
File SystemN/AN/A
SharePoint On-PremBasic Authentication/Username
/Password
SharePoint On-PremADFS/Username
/Password
/UseAdfs
/AdfsHost
/AdfsRelyingPartyIdentifier
SharePoint OnlineBasic Authentication/Username
/Password
SharePoint OnlineModern Authentication/UseModernAuthentication
/AzureAppId
/TenantUrl
/CertificatePath
/CertificatePassword
SharePoint OnlineApp-Only Authentication/UseAppOnlyAuthentication
/ClientID
/ClientSecret
Azure Blob StorageN/A/AzureStorageAccountName
/AzureStorageAccountKey
Azure File ShareN/A/AzureStorageAccountName
/AzureStorageAccountKey

Parameters

ParametersDescription
/OperationThe operation being performed. For this particular case the value for this parameter is “UpdateLibraryLocations
/DocumentLibraryIDThe ID of the Document Searchability document library whose locations are being updated. The ID can be found on the Dashboard or the log file after running a library.
/LocationsTextFileThe path of the text file that contains all the locations that are going to be added. Each location must be in a new line.
/DeleteExistingLocationsWhether or not to delete existing locations. If this is set, all existing locations of the document library will be deleted before adding the new locations
/ValidateLocationsWhether or not to validate each location being added. This will check if the locations already exist in other Document Searchability libraries. If the Library Type is not File System, it will also check if the authentication parameters supplied can be used to access each location.
/ContinueOnLocationValidationErrorIf this is set and /ValidateLocations is also set, locations that are invalid will be skipped. If this is not set and /ValidateLocations is set, processing will be aborted as soon as the first invalid location is encountered and no locations will added or deleted.
/LogToConsoleWhether or not to log the processing status to the console
/LogToFileWhether or not to log the processing status to a log file. If this is set, then a value for /LogFilePath must also be set.
/LogFilePathThe path of the log file if /LogToFile is set.
/DebugWhether or not to log debug information
/UsernameThe username of the user that have access to the locations being added
/PasswordThe password associated with the username of the user that have access to the locations being added
/UseAdfsWhether ADFS is required to access the locations being added
/AdfsHostHostname of the ADFS server E.g. sts.company.com
/AdfsRelyingPartyIdentifierE.g. urn:federation:saml
/UseModernAuthenticationWhether Modern Authentication is required to access the locations being added
/AzureAppIdThe ID of the Azure web application
/TenantUrlThe tenant where the Azure web application resides E.g. <tenant>.onmicrosoft.com
/CertificatePathThe local path of the certificate
/CertificatePasswordThe password for the certificate
/AzureStorageAccountNameThe Azure storage account name
/AzureStorageAccountKeyThe Azure storage account key

Examples

  1. Add new locations to a File System library
    • do not validate the new locations being added
    • do not delete exisiting locations
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="1" /LocationsTextFile="C:\MyFiles\Locations.txt" /LogToConsole /Debug
  1. Add new locations to a SharePoint library
    • with basic authentication
    • validate the new locations being added
    • stop processing if there is an invalid location
    • delete existing locations
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="2" /LocationsTextFile="C:\MyFiles\Locations.txt" /LogToConsole /Debug /Username="[email protected]" /Password="my-plain-password" /ValidateLocations /DeleteExistingLocations
  1. Add new locations to a SharePoint library
    • with modern authentication
    • validate the new locations being added
    • do not stop processing if there is an invalid location
    • delete existing locations
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="3" /LocationsTextFile="*C:\MyFiles\Locations.txt*" /LogToConsole /Debug /UseModernAuthentication /AzureAppId="eaf4cbf1-afed-4c8b-a291-8658757dea44" /TenantUrl="mycompany.onmicrosoft.com" /CertificatePath="C:\Certificates\AzureCert.pfx" /CertificatePassword="cert-plain-password" /ValidateLocations /ContinueOnLocationValidationError /DeleteExistingLocations
  1. Add new locations to a SharePoint library
    • with app-only authentication
    • validate the new locations being added
    • do not stop processing if there is an invalid location
    • delete existing locations
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="3" /LocationsTextFile="*C:\MyFiles\Locations.txt*" /LogToConsole /Debug /UseAppOnlyAuthentication /ClientId="eaf4cbf1-afed-4c8b-a291-8658757dea44" /ClientSecret="client-secret" /ValidateLocations /ContinueOnLocationValidationError /DeleteExistingLocations
  1. Add new locations to an Azure Blob Storage library
    • do not validate the new locations being added
    • delete existing locations
    • log to file
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="1" /LocationsTextFile="*C:\MyFiles\Locations.txt*" /AzureStorageAccountName="teststorageacc" /AzureStorageAccountKey="vvWfxkddddfff" /LogToConsole /LogToFile /LogFilePath="C:\Logs\Log1.txt" /Debug /DeleteExistingLocations
  1. Update existing locations in SharePoint library

    • with ADFS authentication
    • do not validate the new locations being added

    Pre-requisites

    • /DeleteExistingLocations must not be set
    • /LocationsTextFile must contain one or more paths that already exist in the document library being updated** **
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**UpdateLibraryLocations**" /DocumentLibraryID="4" /LocationsTextFile="C:\MyFiles\Locations.txt" /LogToConsole /Debug /UseAdfs /AdfsHost=" sts.company.com" /AdfsRelyingPartyIdentifier="urn:federation:saml"

WARNING: If a location already exists in another Document Searchability library (which can happen if you add locations and do not set /ValidateLocations), the authentication for the location in that library will also change.

Delete locations

This operation allows you to delete locations from a document library using different methods:

  • Delete all locations

  • Delete specific locations

  • Delete specific locations by matching regexes

It aslo allows you to log a list of locations matched by regexes without deleting them from the database. This is useful to debug the regexes you supply.

Usage

Aquaforest.Searchlight.DatabaseManager.exe /Operation="**DeleteLocationsFromLibrary**" /DocumentLibraryID="*\<ID\>*" **{**/DeleteAll **\|** /LocationsTextFile="*\<PATH\>*" **\[**/IsRegex**\] \[**/DryRun**\]}\[**/LogToConsole**\] \[(**/LogToFile /LogFilePath="*\<LOG_PATH\>*"**)\] \[**/Debug**\]**

Parameters

ParametersDescription
/OperationThe operation being performed. For this particular case the value for this parameter is “DeleteLocationsFromLibrary
/DocumentLibraryIDThe ID of the Document Searchability document library whose locations are being deleted. The ID can be found on the Dashboard or the log file after running a library.
/DeleteAllDelete all locations from the library
/LocationsTextFileOnly delete the locations specified in this text file. Each location to be deleted must be in a new line.
- NOTE 1: If /DeleteAll is not set, then a value for this parameter must be set.
- NOTE 2: This text file can either contain a list of plain text paths OR regex paths to delete. It cannot contain a combination of both plain and regex paths.
- NOTE 3: If the text file contains regex paths, the /IsRegex parameter below must be set. The regex paths will matched with unencoded URLs in the case of SharePoint and Azure library types. If a specific URL is being matched using Regex, it should not end with a “/”
- Valid regex:
- ^https://company.sharepoint.com/sites/site1$
- Invalid regex: ^https://company.sharepoint.com/sites/site1/$
/IsRegexSet this if the locations in /LocationsTextFile are regexes. If multiple regexes are specified in the text file, each location will be matched with all of the regexes until a match is found. If no matches are found, the location will not be deleted.
/DryRunUse this to get a list of locations that would have been deleted based on the contents of /LocationsTextFile without actually deleting the locations from the database.
- This is useful if the text file contains regex paths to check which path(s) the regex(es) are successfully matching against.
- NOTE: This is only applicable when when /DeleteAll is not set. It should be used in conjuction with /Debug and /LogToConsole and/or /LogToFile so as to be able to view the paths identified for deletion.
/LogToConsoleWhether or not to log the processing status to the console
/LogToFileWhether or not to log the processing status to a log file. If this is set, then a value for /LogFilePath must also be set.
/LogFilePathThe path of the log file if /LogToFile is set.
/DebugWhether or not to log debug information

Examples

  1. Delete all location from a document library
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**DeleteLocationsFromLibrary**" /DocumentLibraryID="1" /LogToConsole /Debug /DeleteAll
  1. Only delete the locations defined in the text file from a document library
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**DeleteLocationsFromLibrary**" /DocumentLibraryID="2" /LogToConsole /Debug /LocationsTextFile="C:\MyFiles\Locations.txt"
  1. Only delete locations that matches the regexes defined in the text file from a document library
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**DeleteLocationsFromLibrary**" /DocumentLibraryID="3" /LogToConsole /Debug /LocationsTextFile="C:\MyFiles\Locations.txt" /IsRegex
  1. Do not delete locations from database but log the list of the locations matched from the regexes in the text file that would have been deleted if /DryRun was not set.
Aquaforest.Searchlight.DatabaseManager.exe /Operation="**DeleteLocationsFromLibrary**" /DocumentLibraryID="4" /LogToConsole /Debug /LogToFile /LogFilePath="C:\Logs\Logs2.txt" /LocationsTextFile="C:\MyFiles\Locations.txt" /IsRegex /DryRun