Endpoint List Files
Name
list_files
Description
No description available [API reference]
Parameters
| Parameter | Required | Options | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Name:
Label: Drive Id Specify a drive |
YES | |||||||||||||||||||
|
Name:
Label: Site Id (Re-Select Drive Id after you change this) Specify a site |
||||||||||||||||||||
|
Name:
Label: Search Type (i.e. Recursive -OR- Non-Recursive) - Default=Recursive) NOTE: Not Supported with Application Credentials which uses Sites.Selected Scope. If you do not wish to see files from child folders then use Non-Recursive option. Recursive option has certain limitations (e.g. Only indexed files will appear so it takes time to show up in the list). If you do not see some files listed in the output then use Non-Recursive option (must specify Parent Folder Path in SearchPath property). |
|
|||||||||||||||||||
|
Name:
Label: Search Path (Default=Root Folder) - Max 200 items listed |
||||||||||||||||||||
|
Name:
Label: Order By Field(s) - Only for Recursive SearchType Order by Field(s) for output. You can order by single or multiple fields and use filed suffix asc for ascending and desc for descending order. For example to order by lastModifiedDateTime in descending order use lastModifiedDateTime desc. To order by nested field you can supply lastModifiedBy/user/email asc |
|
Output Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description |
|---|---|---|---|---|
| id |
DT_WSTR
|
nvarchar(500)
|
500 | |
| name |
DT_WSTR
|
nvarchar(150)
|
150 | |
| size |
DT_I8
|
bigint
|
||
| createdDateTime |
DT_DBTIMESTAMP
|
datetime
|
||
| lastModifiedDateTime |
DT_DBTIMESTAMP
|
datetime
|
||
| webUrl |
DT_WSTR
|
nvarchar(1500)
|
1500 | |
| webUrlPath |
DT_WSTR
|
nvarchar(1500)
|
1500 | |
| createdBy_user_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| createdBy_user_email |
DT_WSTR
|
nvarchar(150)
|
150 | |
| createdBy_user_displayName |
DT_WSTR
|
nvarchar(100)
|
100 | |
| createdBy_application_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| createdBy_application_displayName |
DT_WSTR
|
nvarchar(100)
|
100 | |
| lastModifiedBy_user_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| lastModifiedBy_user_email |
DT_WSTR
|
nvarchar(150)
|
150 | |
| lastModifiedBy_user_displayName |
DT_WSTR
|
nvarchar(150)
|
150 | |
| lastModifiedBy_application_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| lastModifiedBy_application_displayName |
DT_WSTR
|
nvarchar(150)
|
150 | |
| parentReference_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| parentReference_driveId |
DT_WSTR
|
nvarchar(400)
|
400 | |
| parentReference_driveType |
DT_WSTR
|
nvarchar(100)
|
100 | |
| parentReference_name |
DT_WSTR
|
nvarchar(200)
|
200 | This is only returned when calling lookup or /children call (e.g. /items/root:/[folder-name] OR /items/[item-id] ) |
| parentReference_siteId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| parentReference_path |
DT_WSTR
|
nvarchar(1000)
|
1000 | This is only returned when calling lookup or /children call (e.g. /items/root:/[folder-name] OR /items/[item-id] ) |
| fileSystemInfo_createdDateTime |
DT_DBTIMESTAMP
|
datetime
|
||
| fileSystemInfo_lastModifiedDateTime |
DT_DBTIMESTAMP
|
datetime
|
||
| folder_childCount |
DT_I8
|
bigint
|
||
| file_mimeType |
DT_WSTR
|
nvarchar(300)
|
300 | |
| file_quickXorHash |
DT_WSTR
|
nvarchar(200)
|
200 | |
| file_sha1Hash |
DT_WSTR
|
nvarchar(200)
|
200 | |
| file_sha256Hash |
DT_WSTR
|
nvarchar(200)
|
200 | |
| shared_scope |
DT_WSTR
|
nvarchar(100)
|
100 | |
| remoteItem_parentReference_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_parentReference_driveId |
DT_WSTR
|
nvarchar(400)
|
400 | |
| remoteItem_parentReference_driveType |
DT_WSTR
|
nvarchar(100)
|
100 | |
| remoteItem_parentReference_name |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_parentReference_siteId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_parentReference_path |
DT_WSTR
|
nvarchar(1000)
|
1000 | |
| remoteItem_shared_scope |
DT_WSTR
|
nvarchar(100)
|
100 | |
| remoteItem_shared_sharedDateTime |
DT_DBTIMESTAMP
|
datetime
|
||
| remoteItem_sharedBy_user_id |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharedBy_user_email |
DT_WSTR
|
nvarchar(150)
|
150 | |
| remoteItem_sharedBy_user_displayName |
DT_WSTR
|
nvarchar(150)
|
150 | |
| remoteItem_sharepointIds_listId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_listItemId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_listItemUniqueId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_siteId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_siteUrl |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_tenantId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| remoteItem_sharepointIds_webId |
DT_WSTR
|
nvarchar(200)
|
200 | |
| id_path |
DT_WSTR
|
nvarchar(500)
|
500 | |
| folder_path |
DT_WSTR
|
nvarchar(500)
|
500 |
Input Columns
| Label | Data Type (SSIS) | Data Type (SQL) | Length | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Examples
SSIS
Use SharePoint Online Connector in API Source or in API Destination SSIS Data Flow components to read or write data.
API Source
| Required Parameters | |
|---|---|
| Record Filter (Client Side) | Fill-in the parameter... |
| Drive Id | Fill-in the parameter... |
| Optional Parameters | |
| Site Id (Re-Select Drive Id after you change this) | |
| Search Type (i.e. Recursive -OR- Non-Recursive) - Default=Recursive) | search(q='') |
| Search Path (Default=Root Folder) - Max 200 items listed | /root |
| Order By Field(s) - Only for Recursive SearchType | |
API Destination
| Required Parameters | |
|---|---|
| Record Filter (Client Side) | Fill-in the parameter... |
| Drive Id | Fill-in the parameter... |
| Optional Parameters | |
| Site Id (Re-Select Drive Id after you change this) | |
| Search Type (i.e. Recursive -OR- Non-Recursive) - Default=Recursive) | search(q='') |
| Search Path (Default=Root Folder) - Max 200 items listed | /root |
| Order By Field(s) - Only for Recursive SearchType | |
ODBC application
Use these SQL queries in your ODBC application data source:
List files
<p>Gets all files from a specific drive (document library).</p>
SELECT * FROM list_files
WITH (
-- Drive (SharePoint Document Library)
DriveId='b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-XXXXXXXXXXXXX'
)
--You can get DriveId by selecting from 'Drives' table.
List files in a folder path (recursive)
<p>Lists files recursively (including child folders) using the <code>list_files</code> endpoint. Note that some new or non-indexed files may not appear immediately.</p>
SELECT * FROM list_files
WITH(
Filter='$.value[*]' --list both files and folders
--Filter='$.value[?(@.file.mimeType != null)]' --list only files
--Filter='$.value[?(@.folder.childCount != null)]' --list only folders
-- Drive (SharePoint Document Library)
,DriveId='b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-Sa5UzSpkaY9E'
--Folder which you like to list (If not supplied then Default=root)
--,SearchPath='/root' --default
--,SearchPath='/root:/myfolder:' --folder path
,SearchPath='/root:/myfolder/subfolder:' --folder path nested
,OrderBy='lastModifiedDateTime desc'
)
--You can get DriveId by selecting from 'Drives' table.
List files in a folder ID (non-recursive)
<p>Lists files under a specific Folder ID (non-recursive mode only).</p>
SELECT * FROM list_files
WITH(
Filter='$.value[*]' --list both files and folders
--Filter='$.value[?(@.file.mimeType != null)]' --list only files
--Filter='$.value[?(@.folder.childCount != null)]' --list only folders
-- Drive (SharePoint Document Library)
,DriveId='b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-Sa5UzSpkaY9E'
,SearchType='children' --must use this type if you like to list items by FolderId
--Folder which you like to list (If not supplied then Default=root)
--,SearchPath='/root:/folder/subfolder:'
--OR--
--,SearchPath='/items/01SUOJPKBVT5ZC2KVSXJAYSTTMA4I3GMHX'
)
--You can get DriveId by selecting from 'Drives' table.
SQL Server
Use these SQL queries in SQL Server after you create a data source in Data Gateway:
List files
<p>Gets all files from a specific drive (document library).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM list_files
WITH (
-- Drive (SharePoint Document Library)
DriveId=''b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-XXXXXXXXXXXXX''
)
--You can get DriveId by selecting from ''Drives'' table.';
EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];
List files in a folder path (recursive)
<p>Lists files recursively (including child folders) using the <code>list_files</code> endpoint. Note that some new or non-indexed files may not appear immediately.</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM list_files
WITH(
Filter=''$.value[*]'' --list both files and folders
--Filter=''$.value[?(@.file.mimeType != null)]'' --list only files
--Filter=''$.value[?(@.folder.childCount != null)]'' --list only folders
-- Drive (SharePoint Document Library)
,DriveId=''b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-Sa5UzSpkaY9E''
--Folder which you like to list (If not supplied then Default=root)
--,SearchPath=''/root'' --default
--,SearchPath=''/root:/myfolder:'' --folder path
,SearchPath=''/root:/myfolder/subfolder:'' --folder path nested
,OrderBy=''lastModifiedDateTime desc''
)
--You can get DriveId by selecting from ''Drives'' table.';
EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];
List files in a folder ID (non-recursive)
<p>Lists files under a specific Folder ID (non-recursive mode only).</p>
DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT * FROM list_files
WITH(
Filter=''$.value[*]'' --list both files and folders
--Filter=''$.value[?(@.file.mimeType != null)]'' --list only files
--Filter=''$.value[?(@.folder.childCount != null)]'' --list only folders
-- Drive (SharePoint Document Library)
,DriveId=''b!GtLN726LE0eY5F2BBNi14wMKmwdpCDFMn1d71ra11GuQ4DORpHy-Sa5UzSpkaY9E''
,SearchType=''children'' --must use this type if you like to list items by FolderId
--Folder which you like to list (If not supplied then Default=root)
--,SearchPath=''/root:/folder/subfolder:''
--OR--
--,SearchPath=''/items/01SUOJPKBVT5ZC2KVSXJAYSTTMA4I3GMHX''
)
--You can get DriveId by selecting from ''Drives'' table.';
EXEC (@MyQuery) AT [LS_TO_SHAREPOINT_ONLINE_IN_GATEWAY];