cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
744
Views
0
Helpful
5
Replies

Deleting a message permanently using cumi

Beena
Level 5
Level 5

Hello,

How do I delete a message permanently using cumi? I tried this

DELETE /vmrest/messages/<message-id>?userobjectid=<userobjectid>&harddelete=true

There are no errors but the message never gets removed from Trash folder. I'm connecting to UnityConn ver 9.0.1

Thanks,

Beena

5 Replies 5

Geevarghese Cheria
Cisco Employee
Cisco Employee

Hi Beena,

A POST API call on the Deleted Items folder can be used to empty the whole folder. The messages are hard deleted.

POST /vmrest/mailbox/folders/deleted/messages?method=empty

Reference - Cisco Unity Connection Messaging Interface (CUMI) API -- Using the CUMI API

Thanks and Regards,

Geevarghese

So, there is no option to hard delete a single message? The only option is to clear the whole folder?

Thanks,

Beena

Sure you can delete an individual message – doesn’t matter if it’s in the inbox or deleted items folder. I just used the CUMI REST SDK to write up a quick test that:

Fetched my test user (“jlindborg”) which I assume you already know how to do.

Then for that user I fetch all their deleted messages – you can do this with the following GET construct:

https://192.168.0.188:8443/vmrest/mailbox/folders/deleted/messages?pageNumber=1&rowsPerPage=20&userobjectid=c76af2c6-ec9b-489a-9f10-5acf44588a99


Now I pick one of the messages returned (in my case the ID is: 0:9090453f-4ab0-40ae-b035-6313d2a67b21) and then issue a delete command like this:

DELETE https://192.168.0.188:8443/vmrest/messages/0:9090453f-4ab0-40ae-b035-6313d2a67b21?userobjectid=c76af2c6-ec9b-489a-9f10-5acf44588a99&harddelete=true


Note the “userObjectId=xxx” passed there = that’s the user that owns the message – since I’m logged in as an administrator that’s not the same user that owns the message I’m deleting, with CUPI I have to specify the user’s ID here or it wont find the message being referenced – note that with both calls. If you’re using CUPI for User’s this isn’t necessary since you’re acting on your own behalf and have only access to your own messages which is assumed.


Also note the “harddelete” item on the delete call – to remove something from the deleted items folder this is necessary – when deleting from the inbox its optional (depending on if you want a copy going to the deleted items folder or not).


If you want to see this in action I can do a TOI video showing how this is built in the CUPI REST SDK – just a few lines of code, easy peasy:

http://www.ciscounitytools.com/CodeSamples/Connection/CUPI/CUPI.html

That's the exact delete command I used but the message doesn't get removed from Trash. I'm using CUMI and mailbox delegate account. Is this dependent on the unity connection setting of how long messages should remain in 'deleted items' folder?

Thanks,

Beena

no - I tried it on a couple systems (9.1 and 10.0 ES11), they're definitely removed - no bearing on the setting for how long they stick around in the deleted folders.  In fact looping my script ti runs till there's no more deleted items and then throws back the "no deleted messages" error at the top of my script so I know for sure they're gone.

be double sure you pass the "harddelete" parameter as true - that is required.