Fetch files from a category
Table of Contents
Overview
This task is used to fetch details of all the files in a specified category
Supported Categories
- documents
- spreadsheets
- presentations
- pictures
- music
- videos
- sharedbyme
- sharedtome
- thrashed (stands for Trash)
Syntax
<response> = zoho.docs.retrieveFiles(<category>);
where,
Parameter | Description | Data Type |
<response> | Variable which will hold the response returned by Zoho Docs. It contains details like Folder ID of the folder in which the files exist, File ID (doc ID), and other file-related information. | KEY-VALUE |
<category> | is the category in Zoho Docs from which details of files will be retrieved | TEXT |
Example 1: Retrieve files from Documents category in Zoho Docs
The following script fetches details of all the files from the Documents category in Zoho Docs.
response= zoho.docs.retrieveFiles("documents");
where,
"documents"
Response
The success response returned is of the following format:
{
"FILES":[
"{\"PERMISSION\":3,\"AUTHOR_ID\":\"63882738\",\"FOLDER_ID\":\"kcpn5DOCLIB63882736\",\"SCOPE\":1,\"AUTHOR\":\"John\",\"CREATED_TIME_IN_MILLISECONDS\":1467867319777,\"FILE_EXTN\":\"zwriter\",\"DOCID\":\"nc4un92603ab901a34464a7202377c5911770\",\"LAST_MODIFIEDBY_AUTHOR_NAME\":\"John Mathews\",\"ENCATT_NAME\":\"Syllabus Topics\",\"IS_FAVOURITE\":false,\"ENCHTML_NAME\":\"Syllabus Topics\",\"SHARED_TYPE\":\"PERSONAL\",\"LAST_OPENED_TIME\":\"Jul 7, 2016\",\"LAST_OPENED_TIME_IN_MILLISECONDS\":1467867954975,\"IS_LOCKED\":false,\"AUTHOR_EMAIL\":\"john@zylker.com\",\"CREATED_TIME\":\"Jul 7, 2016\",\"IS_DOCUMENT_VIEWED\":true,\"DOCNAME\":\"Syllabus Topics\",\"FILETYPE\":\"writer\",\"TRIM_DOCNAME\":\"\",\"LAST_MODIFIEDTIME_IN_MILLISECONDS\":1469465062995,\"EXTRA_PROP\":\"{\\\"COLLAB_ID\\\":\\\"2285371717029059312\\\",\\\"FOLDER_TYPE\\\":\\\"LEAF\\\"}\",\"LAST_MODIFIEDBY\":\"63882738\",\"ENCURL_NAME\":\"Syllabus+Topics\",\"IS_SHARED\":false,\"LAST_MODIFIEDTIME\":\"Jul 25, 2016\",\"SERVICE_TYPE\":\"zw\"}"
]
}
To fetch the Folder IDs of all the files returned in the response, execute the following snippet:
for each var1 in var
{
info var1.getJson("FOLDER_ID");
}
To fetch the File IDs of all the files returned in the response, execute the following snippet:
for each var1 in var
{
info var1.getJson("DOCID");
}