ListFilesFromFolder
Lists files from a specified folder in a SharePoint document library. Uses a folder-scoped query to avoid the List View Threshold, supporting libraries with more than 5,000 items.
Stored Procedure-Specific Information
To execute this procedure, enter:EXEC ListFilesFromFolder LibraryName='Shared Documents', FolderServerRelativePath='Shared Documents/data', Scope='Recursive'
Input
| Name | Type | Required | Description |
| LibraryName | String | True | The name of the document library (e.g., 'Shared Documents'). Must match the library name as it appears in FolderServerRelativePath. |
| FolderServerRelativePath | String | True | The server-relative path of the target folder (e.g., '/sites/Site/Shared Documents/SubFolder'). |
| Scope | String | False | Controls whether subfolders are included. FilesOnly returns only files directly in the specified folder. Recursive returns files in the specified folder and all subfolders.
The allowed values are FilesOnly, Recursive. The default value is FilesOnly. |
Result Set Columns
| Name | Type | Description |
| ID | Int | The unique identifier of the list item. |
| EncodedAbsUrl | String | The absolute URL of the file, encoded for use in HTTP requests. |
| FileSizeDisplay | String | The human-readable size of the file (e.g., '12 KB'). |
| Modified | Datetime | The date and time the file was last modified. |
| FileDirRef | String | The server-relative path of the folder that contains the file. |