Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Gmail Trash Folder (via OAuth 2) Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 28 January 2021 at 2:13am | IP Logged Quote hmuscroft

Hi - I've (finally) finished integrating Gmail OAuth 2 into my WinForms desktop application and have spent several weeks jumping through all the hoops Google keep throwing at me - mainly involving making videos demonstrating my app working with Gmail.

Now they've asked me to demonstrate (in a video) my app deleting emails from the Gmail TRASH folder, showing that this also deletes them on Gmail (i.e. in a web browser).

The weird thing is... it doesn't!

So in my app, I call .SelectFolder("[Gmail]/Trash"), then I can read the emails and delete them from the Trash folder.

In my app they have now GONE. If I re-read all the emails in the Gmail Trash folder, they've disappeared - as expected. Great. HOWEVER... they're all still there in the Gmail.com web browser.

It seems that deleting emails from GMAIL TRASH via IMAP actually does NOT get rid of them.

Have you come across this before please? Do you know what GMAIL does with emails once they're deleted from the TRASH folder? Do they go somewhere else or get flagged differently so that the MAILBEE.NET IMAP component doesn't see them any more?

Any idea how to delete emails from the Gmail Trash folder?

Many thanks for your help!

Kind Regards,

Hedley
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 28 January 2021 at 2:56am | IP Logged Quote hmuscroft

OK, I think I can answer this myself.

Stepping through the code, I was ONLY calling IMAP.DeleteMessages(...).

For most servers, calling this on an email in the TRASH folder seems to permanently delete it. With Gmail it doesn't - although goodness knows where it puts it?!

I needed to call IMAP.DeleteMessages(...) followed by IMAP.Expunge(...) to permanently delete messages from the trash.

Please can you confirm that this is correct?
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 5700
Posted: 28 January 2021 at 3:02am | IP Logged Quote Igor

Yes that's right. To quote DeleteMessages method documentation page:

Quote:
This method just sets "\Deleted" flag for the specified messages. To purge deleted messages permanently, call Expunge(String, Boolean) method or explicitly unselect the folder using Close(Boolean) method.


--
Regards,
Igor, Afterlogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide