Saltar al contenido principal

DownloadFilesFromCloudAndImport

Structure

DownloadFilesFromCloudAndImport(sService, sFolder, sToDirectory: Text; dtDateTimeFrom: TDateTime; bAllowAuth, bDeleteCloudAfterImport, bDeleteLocalAfterImport: Boolean): Text

Type

Function

Description

This function will attempt a download of all files with date/time values later than dtDateTimeFrom from the Cloud account specified in the sService. If the sFolder parameter is set then the file will be downloaded from the specified cloud folder. This folder must be one level above the root directory. If no sFolder is specified then the file will be downloaded from the root directory. These ExportImport zip files will be automatically imported into the database. The function will return a summary of completed actions. Search on the text 'ERROR' to confirm if any errors occurred during download or import. Upon execution, if no token exists for the cloud service AND bAuth parameters is True then the service's login screen will be shown in a browser window. This token will be remembered for future sessions. After download if the sToDirectory parameter is set then a copy of the file is saved to this local directory. If bDeleteCloudAfterImport is True then the file is deleted from the cloud after successful import. If bDeleteLocalAfterImport is True then the file is deleted from the local location (sToDirectory) after successful import.

Parameters: 7

sService = the name of the online cloud service. Acceptable values are: 'BOX' (box.com) and 'DROPBOX' (dropbox.com)

sFolder = If the sFolder parameter is set then the file will be downloaded from the specified cloud folder. This folder must be one level above the root directory. If no sFolder is specified then the file will be downloaded from the root directory.

sToDirectory = If this parameter is specified then after download the file will be copied to this local directory

dtDateTimeFrom = earliest Date/Time for an import file. Files earlier than this date/time will be ignored.

bAllowAuth = If previous tokens saved to the database are not found and/or do not allow access to the online service, this parameter determines if a browser window should be shown to allow for credentials to be entered. If this script is intended to be run in an automated/unattended setup, then this parameter should be set to False.

bDeleteCloudAfterImport = If True then the file is deleted from the cloud after successful import.

bDeleteLocalAfterImport = If True then the file is deleted from the local location (sToDirectory) after successful import.

Return Value

Text

Examples

sResult = DownloadFilesFromCloudAndImport("DROPBOX", "", "C:\Temp\Downloaded", (Now - 1), True, False, False)

DebugLog(sResult) |