Service: zimbraMail

Command: FolderAction
Namespace: urn:zimbraMail
Description: Perform an action on a folder
Actions:
   <action op="read" id="{list}"/>
     - mark all items in the folder as read

   <action op="delete" id="{list}"/>
     - hard-delete the folder, all items in the folder, and all the folder's subfolders

   <action op="empty" id="{list}" [recusive="{delete-subfolders}"]/>
     - hard-delete all items in the folder (and all the folder's subfolders if "recursive" is set)

   <action op="rename" id="{list}" name="{new-name}" [l="{new-folder}"]/>
     - change the folder's name (and optionally location);
       if {new-name} begins with '/', the folder is moved to the new path and any missing path elements are created

   <action op="move" id="{list}" l="{new-folder}"/>
     - move the folder to be a child of {target-folder}

   <action op="trash" id="{list}"/>
     - move the folder to the Trash, marking all contents as read and
       renaming the folder if a folder by that name is already present in the Trash

   <action op="color" id="{list}" color="{new-color} rgb="{new-color-in-rgb}"/>
     - see ItemActionRequest

   <action op="grant" id="{list}">
     <grant perm="..." gt="..." zid="..." [expiry="{millis-since-epoch}"] [d="..."] [key="..."]/>
   </action>
     - add the <grant> object to the folder

   <action op="!grant" id="{list}" zid="{grantee-id}"/>
     - revoke access from {grantee-id}
         (you can use "00000000-0000-0000-0000-000000000000" to revoke acces granted to "all"
         or use "99999999-9999-9999-9999-999999999999" to revoke acces granted to "pub" )

   <action op="revokeorphangrants" id="{folder-id}" zid="{grantee-id}" gt="{grantee-type}"/>
     - revoke orphan grants on the folder hierarchy granted to the grantee specified by zid and gt
       "orphan grant" is a grant whose grantee object is deleted/non-existing.  Server will throw
       INVALID_REQUEST if zid points to an existing object,
       Only supported if gt is usr|grp|cos|dom; otherwise server will throw INVALID_REQUEST.

   <action op="url" id="{list}" url="{target-url}" [excludeFreeBusy="{exclude-free-busy-boolean}"]/>
     - set the synchronization url on the folder to {target-url}, empty the folder, and\
       synchronize the folder's contents to the remote feed, also sets {exclude-free-busy-boolean}

   <action op="sync" id="{list}"/>
     - synchronize the folder's contents to the remote feed specified by the folder's {url}

   <action op="import" id="{list}" url="{target-url}"/>
     - add the contents to the remote feed at {target-url} to the folder [1-time action]

   <action op="fb" id="{list}" excludeFreeBusy="{exclude-free-busy-boolean}"/>
     - set the excludeFreeBusy boolean for this folder (must specify {exclude-free-busy-boolean})

   <action op="[!]check" id="{list}"/>
     - set or unset the "checked" state of the folder in the UI

   <action op="[!]syncon" id="{list}"/>
     - set or unset the "sync" flag of the folder to sync a local folder with a remote source
     
   <action op="[!]disableactivesync" id="{list}"/>
     - If set, disable access to the folder via activesync.
       Note: Only works for user folders, doesn't have any effect on system folders.

   <action op="webofflinesyncdays" id="{list}" numDays="{web-offline-sync-days}/>
     - set the number of days for which web client would sync folder data for offline use
       {web-offline-sync-days} must not be greater than value of zimbraWebClientOfflineSyncMaxDays account attribute

   <action op="update" id="{list}" [f="{new-flags}"] [name="{new-name}"]
                          [l="{target-folder}"] [color="{new-color}"] [view="{new-view}"]>
     [<acl><grant .../>*</acl>]
   </action>
     - do several operations at once:
           name="{new-name}"        to change the folder's name
           l="{target-folder}"      to change the folder's location
           color="{new-color}"      to set the folder's color
           view="{new-view}"        to change folder's default view (useful for migration)
           f="{new-flags}"          to change the folder's exclude free/(b)usy, checked (#), and
                                    IMAP subscribed (*) state
           <acl><grant ...>*</acl>  to replace the folder's existing ACL with a new ACL

     {list} = on input, list of folders to act on, on output, list of folders that were acted on;
              list may only have 1 element for actions empty, sync, fb, check, !check, url, import, grant,
              !grant, revokeorphangrants, !flag, !tag, syncon, !syncon, retentionpolicy

 output of "grant" action includes the zimbra id the rights were granted on

 note that "delete", "empty", "rename", "move", "color", "update" can be used on search folders as well as standard
 folders
 
Properties:
Authorization token required true
Admin Authorization token required false

FolderActionRequest

    <FolderActionRequest> ## FolderActionRequest
        <action [recursive="{delete-subfolders} (0|1)"] [url="{target-url}"]
                   [excludeFreeBusy="{exclude-free-busy-boolean} (0|1)"] [zid="{grantee-id}"] [gt="{grantee-type}"]
                   [view="{default-view}"] [numDays="{web-offline-sync-days} (Integer)"] [type="{empty-folder-op-type}"]
                   [id="{comma-sep-ids}"] op="{operation}" [tcon="{[-]constraint}"] [tag="{tag} (Integer)"] [l="{folder-id}"]
                   [rgb="{rgb-color}"] [color="{color} (Byte)"] [name="{name}"] [f="{flags}"] [t="{tags}"] [tn="{tag-names}"]
                   [nei="{non-existent-ids} (0|1)"] [nci="{newly-created-ids} (0|1)"]> ## FolderActionSelector
            <grant perm="{rights}" gt="{grantee-type}" [zid="{id}"] [d="{grantee-name}"] [args="{obsolete-use-pw}"]
                       [pw="{password}"] [key="{access-key}"] /> ## ActionGrantSelector
            <acl>
                (<grant ... /> ## See /action/grant [ ## ActionGrantSelector])*
            </acl>
            <retentionPolicy> ## RetentionPolicy
                <purge>
                    (<policy [type="{retention-policy-type} (user | system)"] [id="{id}"] [name="{name}"]
                                 [lifetime="{policy-duration}"] /> ## Policy)*
                </purge>
             </retentionPolicy>
        </action>
    </FolderActionRequest>

elements and attributes you can define within a <FolderActionRequest> element:

XPath Required / Optional Description
/action Required (only 1) Select action to perform on folder
/action@recursive Optional (0 or 1) Type: 0|1
For op="empty" - hard-delete all items in the folder (and all the folder's subfolders if "recursive" is set)
/action@url Optional (0 or 1) Type: String
Target URL
/action@excludeFreeBusy Optional (0 or 1) Type: 0|1
For op="fb" - set the excludeFreeBusy boolean for this folder (must specify {exclude-free-busy-boolean} for op="fb")
/action@zid Optional (0 or 1) Type: String
Grantee Zimbra ID
/action@gt Optional (0 or 1) Type: String
Grantee Type
/action@view Optional (0 or 1) Type: String
Use with op="update" to change folder's default view (useful for migration)
/action@numDays Optional (0 or 1) Type: Integer
Number of days for which web client would sync folder data for offline use
/action@type Optional (0 or 1) Type: String
Match type for folder action "op":"empty"
Legal values are: emails|contacts|appointments
/action@id Optional (0 or 1) Type: String
Comma separated list of item IDs to act on. Required except for TagActionRequest, where the tags items can be specified using their tag names as an alternative.
/action@op Required (only 1) Type: String
Operation
For ItemAction - delete|dumpsterdelete|recover|read|flag|priority|tag|move|trash|rename|update|color|lock|unlock|resetimapuid|copy
For MsgAction - delete|read|flag|tag|move|update|spam|trash
For ConvAction - delete|read|flag|priority|tag|move|spam|trash
For FolderAction - read|delete|rename|move|trash|empty|color|[!]grant|revokeorphangrants|url|import|sync|fb|[!]check|update|[!]syncon|retentionpolicy|[!]disableactivesync|webofflinesyncdays
For TagAction - read|rename|color|delete|update|retentionpolicy
For ContactAction - move|delete|flag|trash|tag|update
For DistributionListAction -
    delete         delete the list
    rename         rename the list
    modify         modify the list
    addOwners      add list owner
    removeOwners   remove list owners
    setOwners      set list owners
    grantRights    grant rights
    revokeRights   revoke rights
    setRights      set rights
    addMembers     add list members
    removeMembers  remove list members
    resetimapuid   reset IMAP item UIDs
 
/action@tcon Optional (0 or 1) Type: String
List of characters; constrains the set of affected items in a conversation
t include items in the Trash
j include items in Spam/Junk
s include items in the user's Sent folder (not necessarily "Sent")
d include items in Drafts folder
o include items in any other folder
A leading '-' means to negate the constraint (e.g. "-t" means all messages not in Trash)
/action@tag Optional (0 or 1) Type: Integer
Deprecated - use "tn" instead
/action@l Optional (0 or 1) Type: String
Folder ID
/action@rgb Optional (0 or 1) Type: String
RGB color in format #rrggbb where r,g and b are hex digits
/action@color Optional (0 or 1) Type: Byte
color numeric; range 0-127; defaults to 0 if not present; client can display only 0-7
/action@name Optional (0 or 1) Type: String
Name
/action@f Optional (0 or 1) Type: String
Flags
/action@t Optional (0 or 1) Type: String
Tags - Comma separated list of integers. DEPRECATED - use "tn" instead
/action@tn Optional (0 or 1) Type: String
Comma-separated list of tag names
/action@nei Optional (0 or 1) Type: 0|1
Flag to signify that any non-existent ids should be returned
/action@nci Optional (0 or 1) Type: 0|1
Flag to signify that ids of new items should be returned
applies to COPY action
/action/grant Optional (0 or 1)
/action/grant@perm Required (only 1) Type: String
Rights
/action/grant@gt Required (only 1) Type: String
Grantee Type - usr | grp | cos | dom | all | pub | guest | key
/action/grant@zid Optional (0 or 1) Type: String
Zimbra ID
/action/grant@d Optional (0 or 1) Type: String
Name or email address of the grantee. Not present if {grantee-type} is "all" or "pub"
/action/grant@args Optional (0 or 1) Type: String
Retained for backwards compatibility. Old way of specifying password
/action/grant@pw Optional (0 or 1) Type: String
Optional argument. Password when {grantee-type} is "gst" (not yet supported)
/action/grant@key Optional (0 or 1) Type: String
Optional argument. Access key when {grantee-type} is "key"
/action/acl Required (only 1)
/action/acl/grant Optional (0 or more) See /action/grant for more details.
/action/retentionPolicy Optional (0 or 1) Retention policy
/action/retentionPolicy/purge Required (only 1)
/action/retentionPolicy/purge/policy Optional (0 or more)
/action/retentionPolicy/purge/policy@type Optional (0 or 1) Type: user | system
Retention policy type
/action/retentionPolicy/purge/policy@id Optional (0 or 1) Type: String
ID
/action/retentionPolicy/purge/policy@name Optional (0 or 1) Type: String
Name
/action/retentionPolicy/purge/policy@lifetime Optional (0 or 1) Type: String
Duration

FolderActionResponse

    <FolderActionResponse> ## FolderActionResponse
        <action [zid="{grantee-id}"] [d="{display-name}"] [key="{access-key}"] id="{success-ids}" op="{operation}"
                   [nei="{non-existent-ids}"] [nci="{newly-created-ids}"] /> ## FolderActionResult
    </FolderActionResponse>

elements and attributes you can define within a <FolderActionResponse> element:

XPath Required / Optional Description
/action Required (only 1) Folder action result
/action@zid Optional (0 or 1) Type: String
Grantee Zimbra ID
/action@d Optional (0 or 1) Type: String
Display name
/action@key Optional (0 or 1) Type: String
Access key (Password)
/action@id Required (only 1) Type: String
Comma-separated list of ids which have been successfully processed
/action@op Required (only 1) Type: String
Operation
/action@nei Optional (0 or 1) Type: String
Comma-separated list of non-existent ids (if requested)
/action@nci Optional (0 or 1) Type: String
Comma-separated list of newly created ids (if requested)