Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 115
Registered: ‎10-24-2009
My Device: Not Specified

Deleting mails

hi..........

 

please help me to solve this problem...

 

is it possible to delete mails both in handheld and account programmatically ?

 

and i want to know about <$removeondelivery>.........

 

 

please guide me regarding this 

 

 

thanks

Developer
Posts: 16,498
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Deleting mails

this depends on the sync settings of the user. usually a mail deleted on the handheld is also deleted on the account (exchange/notes)

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 115
Registered: ‎10-24-2009
My Device: Not Specified

Re: Deleting mails

can we programmatically delete mails on both ends ??

 

this is the code am using to delete mails

but its deleting only on handheld not on account

 

Store store=null;
	
	try {
		 store = Session.waitForDefaultSession().getStore();
		} catch (NoSuchServiceException e) {
		System.out.println(e.toString());
		}
		
		Folder[]  folders = store.list(Folder.SENT); 
        Folder    sentfolder = folders[0]; 
        
        Message msg[] = null;
        
        try {
			msg=sentfolder.getMessages();
		} catch (MessagingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        int count =msg.length;
        
        for(int j=0;j<count;j++)
        {
        	Message m=msg[j];
        	String str=m.getSubject();
        	if(str.startsWith("C"))
        	{
        		sentfolder.deleteMessage(m,true);
        	}
        	
        }
        
	

 

 

Developer
Posts: 16,498
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Deleting mails

works on my device. as i said, depends on your sync settings.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Deleting mails

Hello simon_hain,

 

 

Will you please explain sync settings in detail? I have deleted the email from handheld. But I want to delete it from mail box also. How should I proceed?

 

 

Thank you

 

 

Developer
Posts: 16,498
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Deleting mails

mail options e-mail-synchronization

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Deleting mails

Hello simon_hain,

 

 

I found option of (delete on--Mailbox & handheld) in Email Reconciliation.

But not able to find the sync option. Will you please tell me where the option is?

 

 

 

Thank you

Developer
Posts: 16,498
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Deleting mails

the option you found is the correct one, i mistranslated my (german) menu entry

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: Deleting mails

Hello simon_hain,

 

Thank you for your reply

 

 

I will try this and let you know what happens :smileytongue:

 

 

 

Thanks and regards