Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

How can I delete VOice Mails programatically

Is there a way to delete phone voice messages programatically or by deleating rows in the data base

any help? please

Cisco Employee

Re: How can I delete VOice Mails programatically

For Unity or Connection? Makes a big difference...

for Unity the messages are stored in Exchange, not locally in SQL - you have to delete messages going directly through the mailbox using something like CDO libraries. You can check out the CDO example on the code samples page for an idea of how to go about this:

For connection you could do it through SQL stored procs.

Neither method is supported by TAC, of course - you're on your own from that perspective.


Re: How can I delete VOice Mails programatically

for exchange based unity voice mail, do the following to delete mass VMs at once:

1) login to the exchange server as an admin.

2) browse and locate the folder/directory called MBX. (short for mailbox)

this is a folder that contains all users and their VM boxes. (inbox is where all VMs are held)(MBX folder is located under the FQDN folder that represents your unity within the active directory; something like "" or the likes.

3) open the MBX folder when you find it. it may take awhile to open and display the contents depending on how many subscribers it contains.

4) find the subscriber folder via their 'alias'. (the folders are named after the alias of a subscriber)

5) in the subscribers 'alias' folder, there will be an "INBOX". it is here in the inbox that you will find all Voice Mails in .EML file format.

6) highlight the voicemails (.EML) files you want to delete and delete them. they will no longer be available for listening to by the subscriber.

you can also use this method to listen to voice mails. once in the subscribers 'alias' INBOX folder, open a .EML file with outlook or outlook express. you can then listen to the attachment which is the voice mail in .WAV format.

New Member

Re: How can I delete VOice Mails programatically

I've seen the MBX directory structure and wondered if it was safe to delete messages from users' mailboxes there. Is this procedure safe? Will it break something like MWI's or other unity related funtions? thanks! -matt


Re: How can I delete VOice Mails programatically

it is absolutely safe to delete voice mails from the MBX structure.

i do it quite frequently for maintenance reasons.

ie: a corrupt message found by the backup system. this message must be deleted so i use the MBX structure to delete.

also, i copy & move voice mails to/from the MBX structure when required.

ie: a user wants to make a broadcast. i have them dial their own voice mail and record a message. i then remove the message from the MBX structure and place it into the broadcastManager.

it is OK to move, copy, delete files from the MBX structure.

Re: How can I delete VOice Mails programatically

Hi -

Just my two cents - make sure you have good backups of your Exchange environment and a restore configuration to restore a user's mailbox or mail, if needed. And if your Exchange environment is unified messaging, i.e. voice, email, and fax in the same inbox, I would be very careful about deleting messages in this manner and know what you are doing. If you don't have this level of comfort or knowledge, you can use Cisco's provided method - Message Store Manager -


New Member

Re: How can I delete VOice Mails programatically

Thanks, we solved the issue by deleting messages in user inbox, since it is a hotel application we do not need to storage all the messages from customers that allready check out the hotel.

Best Regards,

Juan Ramon Tejada

From Mexico City


Re: How can I delete VOice Mails programatically

If this is for a hotel, why don't you use the Bulk Subscriber Reset tool?

You could also use the Message Store Manager to delete older voicemails from a day old and older.

New Member

Re: How can I delete VOice Mails programatically


I tried to delete saved and new messages for users from the inbox folder, but they still can be checked from phone. It seems to be stored somewhere else. But if I tried to delete it from phone, I can see it disappear from the folder.

So is there some way to purge the voicemail right away? Also how to change the status of the voicemail, say change it to be un-read?

Many thanks,

New Member

Re: How can I delete VOice Mails programatically

We managed to delete all the messages in the inbox folder using a generic user that can delete messages from any inbox.

All the messages were deleted and could not been checked from the phone.

Here a Java Example




import java.util.Iterator;

import java.util.List;


import org.apache.commons.codec.binary.Base64;



* @author jxm02697


public class Delete {


* Creates a new instance of Delete


public Delete() {


System.setProperty("java.protocol.handler.pkgs", "");




public void delete(String path) {

BufferedReader input = null;

String line=null;

String resultado="";

Base64 encoder = new Base64();

String credentials = "jxm02697:Yamcha777";

Proxy proxy = detectProxy(path);

try {

byte[] userpwd = encoder.encode(credentials.getBytes());

StringBuffer sb= new StringBuffer("");

for(int i=0; i < userpwd.length; i++){



URL url = new URL(path);

//HttpURLConnection con = (HttpURLConnection)url.openConnection(proxy);

HttpsURLConnection con = (HttpsURLConnection)url.openConnection(proxy);


con.setRequestProperty( "Authorization", "Basic " + sb.toString().trim());

input = new BufferedReader( new InputStreamReader(

con.getInputStream() ) );

while ( true ) {

line= input.readLine();

if ( line == null )


resultado += line;


System.out.println("Resultado:\n" + resultado);


catch (Exception e) {




public Proxy detectProxy(String path)


Proxy proxy = null;

try {

ProxySelector ps = ProxySelector.getDefault();

URI uri = null;

uri = new URI(path);

List proxyList =;

if (proxyList != null && proxyList.size() > 0) {

for (Iterator iter = proxyList.iterator(); iter.hasNext(); ) {

proxy = (Proxy);

System.out.println("Tipo Proxy : " + proxy.type());

InetSocketAddress addr = (InetSocketAddress)proxy.address();

if (addr == null) {

System.out.println("No se necesita proxy.");


else {

System.out.println("proxy hostname : " +


System.out.println("proxy port : " +






else {

System.out.println("No se encontraron proxis");


}catch (Exception ex) {



return proxy;


public static void main (String[] args) {

Delete test = new Delete();





New Member

Re: How can I delete VOice Mails programatically


My problem is after I deleted the mails under INBOX folder, the user still can check those voicemails. The updated news is that the next day, those voicemails disappear! I believe they were cached somewhere. Still I do not know how to change a read-mail to un-read by modifying the file properties from server.

Thanks again.

CreatePlease login to create content