Choose where you’d like to start

Create folder in Zoho Mail

Note: This task is applicable to all Zoho services, except Zoho Creator.

Overview

The zoho.mail.createFolder task is used to create a new folder in Zoho Mail.

Syntax

<response> = zoho.mail.createFolder(<folderName>, <parent_folder_id>, <connection>);

where:

ParamsData typeDescription

<response> 

KEY-VALUE

The status of the executed task.

<folderName> 

TEXT

The name of the folder that will be created.

<parent_folder_id>

NUMBER

The ID of the folder within which the new folder will be created.

Note:
  • You can get the parent_folder_id from the Zoho Mail URL. The URL is in the following format:
    https://mail.zoho.com/zm/#mail/folder/<parent_folder_id>/p/<message_id>
    (or)
    You can get the parent_folder_id by using the get folders task. Click here to learn more.
  • To skip this param, supply 0 as its value. 

<connection>

TEXT

The link name of the Zoho Mail connection

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • The scope required for this task as mentioned by Zoho Mail API is: folders
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example 1

The following script creates a new folder with the specified name in Zoho Mail:

response = zoho.mail.createFolder("Folder1", 0, "mail_oauth_connection");

where:

response
The KEY-VALUE response that represents the status of the executed task.
"Folder1"
The TEXT that represents the name of the folder that will be created.
"mail_oauth_connection"
The TEXT that represents the link name of the Zoho Mail connection.

Example 2

The following script creates a sub folder under an existing folder in Zoho Mail:

response = zoho.mail.createFolder("InboxSubFolder", 6729326000000008021, "mail_oauth_connection");

where:

"InboxSubFolder"
The TEXT that represents the name of the subfolder that will be created.
6729326000000008021
The NUMBER that represents the ID of the parent folder.
"mail_oauth_connection"
The TEXT that represents the link name of the Zoho Mail connection.

Response Format

Success Response

  • The success response returned is of the following format:
     {
     "message":"Action createFolder is successful",
     "status":"success"
     }

Failure Response

  • The failure response returned is of the following format:
     {
     "message":"Error while processing the request! You are not allowed to create folder with this name.",
     "status":"failure"
     }

Related Links

Get Started Now

Execute