Choose where you’d like to start

Fetch files from a category

Note: As previously announced, Zoho Docs is being discontinued and the Deluge Docs integration tasks will stop executing starting 15th September 2023. For your advanced file management and collaboration requirements, we recommend you refer to the WorkDrive API documents as an alternative.

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)
Note: On average, it takes about a minute to index a file/folder after it is created or updated. This indexing time can increase if the queue size increases. You will not get the expected result if you execute zoho.docs.retrieveFiles task before the files you need to fetch are indexed.

Syntax

<response> = zoho.docs.retrieveFiles(<category>);

where,

ParameterDescriptionData 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"
is the category from which the files have to be retrieved. It is of TEXT data type.

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:

var = <response_variable>.get("FILES");
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:

var = <response_variable>.get("FILES");
for each var1 in var
{
  info var1.getJson("DOCID");
}

Get Started Now

Execute