Choose where you’d like to start

Move to folder in Zoho Mail

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

Overview

The zoho.mail.moveToFolder task is used to move an email from one folder to another in Zoho Mail. This task is based on a Zoho Mail API.

Syntax

<response> = zoho.mail.moveToFolder(<message_id>, <folder_id>/<folder_path>, <connection>);

where:

ParamsData typeDescription

<response> 

KEY-VALUE

The status of the executed task.

<message_id> 

NUMBER

The ID of the email that will be moved to the specified folder.

Note: You can get the message_id  from the Zoho Mail URL. The URL is in the following format:
https://mail.zoho.com/zm/#mail/folder/<folder_id>/p/<message_id>

<folder_id>/

<folder_path>

NUMBER/ TEXT

The ID or path of the folder into which the email will be moved.

Note:

  • You can get the folder_id from the Zoho Mail URL. The URL is in the following format:
    https://mail.zoho.com/zm/#mail/folder/<folder_id>/p/<message_id>
    (or)
    You can get the folder_id by using the get folders task. Click here to learn more about it.
  • The folder_id must be provided as NUMBER and folder_path must be provided as TEXT.

<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 moves an email to the folder of ID - 6729326000000008021 in Zoho Mail:

response = zoho.mail.moveToFolder(6729326000001837113, 6729326000000008021, "mail_oauth_connection");

where:

response
The KEY-VALUE response that represents the status of the executed task.
6729326000001837113
The NUMBER that represents the ID of the email that needs to be moved to the specified folder.
6729326000000008021
The NUMBER that represents the ID of the folder into which the email needs to be moved.
"mail_oauth_connection"
The TEXT that represents the link name of the Zoho Mail connection.

Example 2

The following script moves an email to the folder with path - /inbox/folder1 in Zoho Mail:

response = zoho.mail.moveToFolder(6729326000001837113, "/inbox/folder1", "mail_oauth_connection");

where:

"/inbox/folder1"
The TEXT that represents the path of the folder into which the email needs to be moved.
"mail_oauth_connection"
The TEXT that represents the link name of the Zoho Mail connection.

Response Format

Success Response

  • The success response will be returned in the following format:
      {
      "message":"Action moveMessage is successful",
      "status":"success"
      }

     

Failure Response

  • The failure response will be returned in the following format:
      {
      "message":"Error while processing the request! Folder does not exist",
      "status":"failure"
    }

     

Related Links

Get Started Now

Execute