How to manage user defined retention with cli

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
derbärtigefrytz
Posts: 7
Joined: Mon Oct 31, 2016 12:49 pm
Location: Germany

How to manage user defined retention with cli

Post by derbärtigefrytz »

Hello Sirs,
With ZCS 8.8.15 on UBUNTU18_64 I want to manage (modify/delete) retention policies that where set by a user for a specific folder.
How can this be done with cli commands?
How can I create such a policy with cli commands?

Users have set it by ticking "Enable Message Disposal" and choosing a custom "Disposal Threshold" in the folders properties.
I can see these settings by calling "zmsoap -z -m <user> -v GetFolderRequest"
<folder...
<retentionPolicy>
<keep/>
<purge>
<policy lifetime="1464d" type="user"/>
</purge>
</retentionPolicy>
</folder>

I can not find the setting in the user properties that I can set with "zmprov ma". All props regarding lifetime are zero.
I can not find a zmmailbox command, that does the job.
Any help is appreciated. Did I miss anything?

Best regards
Frytz
derbärtigefrytz
Posts: 7
Joined: Mon Oct 31, 2016 12:49 pm
Location: Germany

Re: How to manage user defined retention with cli

Post by derbärtigefrytz »

Uh, 500 views and no hint.
Does this mean, it is impossible, or did I explain my problem misleading?

Please let me know, if you need more details.
Any help is appreciated.

Regards
Frytz
liverpoolfcfan
Elite member
Elite member
Posts: 1112
Joined: Sat Sep 13, 2014 12:47 am

Re: How to manage user defined retention with cli

Post by liverpoolfcfan »

Best way to work out what is happening is to use the browser Debug Tools (press F12)

If you open the "Network" tab you can see the requests/responses from the browser to/from the server.

Open a folder's properties, make a change to the retention settings, and save. You will see a "BatchRequest". Click on it to bring up the details. Select the "Headers" tab in the details panel. Scroll down until you see "Request Payload". Expand all of the dropdowns to see the details of the request in JSON format - Header->Body->BatchRequest->FolderActionRequest->....., etc. If you want to work with XML format, yo will need to work out the format yourself.

The BatchRequest is just what it sounds like. It is a wrapper for sending a Batch of Soap Commands to the server in a single request.
FolderActionRequest: [{_jsns: "urn:zimbraMail", action: {op: "retentionpolicy", id: "161425",…}, requestId: 0}]
shows you the request is a FolderActionRequest in the "zimbraMail" context, whose "op"eration is "retentionpolicy", in this case on folder 161425, etc.
Keep expanding all of the dropdowns to see all of the details.

Finally click across to the Response tab in the details panel. You can see the JSON response from the command, showing the success/failure. From here you can figure out what to look for to verify it was successful.
liverpoolfcfan
Elite member
Elite member
Posts: 1112
Joined: Sat Sep 13, 2014 12:47 am

Re: How to manage user defined retention with cli

Post by liverpoolfcfan »

Once you have found the relevant Soap command, FolderActionRequest in this case, grep the files in /opt/zimbra/docs to locate the documentation for it

Code: Select all

[root@mail mail]# cd /opt/zimbra/docs/
[root@mail docs]# grep -ir FolderAction
soap.txt:<FolderActionRequest>
soap.txt:</FolderActionRequest>
soap.txt:<FolderActionResponse>
soap.txt:</FolderActionResponse>
sync.txt:<FolderActionRequest>
sync.txt:</FolderActionRequest>
share.md:interface. The FolderActionRequest is used to grant such access
[root@mail docs]#
So, this request is documented in soap.txt

If you search that file for retentionPolicy, you will find the usage and the structure of the retentionPolicy request.
Post Reply