4. List files API [ D_pxListFiles ]
Goal:
Create an activity that list files and folders of the directory you specified. This information is returned by a page list format.
To list files with this D_pxListFiles API, pass in the following parameters:
Before we get started, let's review what this D_pxListFiles API does accurately. Let's say, there is a file and folder structure in a repository like below.
Be noted, that List files API only returns the list of files and folders under the folder you specified. It doesn't return the whole structure under it.
- If you specify "/", which is the root directory, you get /parentfolder1 and /parentfolder2.
- If you specify "/parentfolder1", you get /childfolder1, childfolder2.
- If you specify "/parentfolder1/childfolder1", you get EmployeeData.csv and grandson folder.
- If you specify "/parentfolder1/childfolder2", you don't get anything.
- If you specify "/parentfolder2", you get childfolder1.
- If you specify "/parentfolder2/childfolder1", you get EmployeeData.csv.
In this example, I actually created the same structure as above.
I will show one example here - I specified "/parentfolder1/childfolder1".
1. Create an activity as below.
2. First of all, add an new entry to Pages & Classes. Add "D_pxGetFile" in Page name, and add "Embed-Repository-File" in Class.
3. In the Step 1, I am setting required parameters for D_pxListFiles API.
4. In the Step 2, specify the D_pxListFiles[repositoryName:Param.repositoryName,folderPath:Param.folderPath] in the step page.
I am only specifying the API in Step Page but you can also use Load-DataPage method in activity also.
0 Comments