Automating a complete workflow
Now that we have discovered the most important methods available (not all of them, that's what the documentation is for), we can try and get our hands on the workflow that we suggested in the introductory example.
Just a reminder of that example is as follows:
You want to set up a filter that sets a label on every message coming from your boss, but you also want to keep an archive of it in a document along with a link to the attachments stored in your drive to be able to quickly search any reference he might have sent you. You would prefer that his e-mail messages remain in your main mailbox the whole day to be sure that you don't forget to read them.
I'm warning you, this code is a bit long.
When I imagined the example workflow, I thought it could be quite simple but some of the features need a lot of code lines, particularly the part that shows the attachment data in a table. I also wanted it to be simple to set up, so it creates the folders, the labels, the...