You can specify multiple search terms in one query. You just need to use single and double quotes properly:
gam all users delete messages query 'from:bad...@example.com subject:"bad message"'
See the advanced Gmail search guide for more examples:
https://support.google.com/mail/answer/7190?hl=en
Jay
--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/118564c0-9e5b-4aef-9521-ca44d41090d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jay Lee
You can specify multiple search terms in one query. You just need to use single and double quotes properly:
gam all users delete messages query 'from:...@example.com subject:"bad message"'
See the advanced Gmail search guide for more examples:
https://support.google.com/mail/answer/7190?hl=en
Jay
On Wed, Mar 16, 2016, 6:08 PM Stevie Howard <stevie...@edmonton.ca> wrote:
Hi David,I'd be very interested in seeing that Python script too, thanks!
On Wednesday, August 12, 2015 at 10:18:09 AM UTC-6, David Silva wrote:Resolved outside of GAM:Well with no replies I went a different route and used a Python script that allows many different search criteria and then purges the email. You can delete as many emails that meet the criteria in the users' email and determine if you want it sent to "trash" or purged entirely.Note: This script would also be useful for applying a label to messages that meet a certain search criteria.If anyone is interested in the script, let me know and I can send it over.
On Monday, August 10, 2015 at 11:30:10 AM UTC-5, David Silva wrote:I am currently trying to find emails with multiple search criteria to purge from all users' inboxes.Running a delete like so works like a charm:gam user first...@emailaddress.com delete messages query subject:"test subject" doit--Searching by any one single criteria works very well for us but how do I use "AND" as an operator?My issue is that I need to delete multiple messages (all have different ID's) all sent from one sender and with on subject.Any guidance on the subject would be very helpful!Thanks!
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/118564c0-9e5b-4aef-9521-ca44d41090d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Jay Lee
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/118564c0-9e5b-4aef-9521-ca44d41090d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
----Jay Lee
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c9648304-2ca7-427e-95f8-44c4b3f9445b%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/118564c0-9e5b-4aef-9521-ca44d41090d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Jay Lee
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c9648304-2ca7-427e-95f8-44c4b3f9445b%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/b4658911-b9a1-46f4-83f6-da06d924dad3%40googlegroups.com.
Scott,Here is the documentation: https://developers.google.com/drive/v2/web/search-parametersIt looks like OR should be orRoss
On Thu, Oct 19, 2017 at 12:44 PM, Scott Marquardt <scott.m...@menta.com> wrote:
I'm curious about OR queries as well.
I think this is working for me:gam print users query "orgUnitPath='/students'" | gam csv - gam user ~primaryEmail delete drivefile "query:mimeType contains 'audio' OR mimeType contains 'video'" purge
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/b4658911-b9a1-46f4-83f6-da06d924dad3%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/92a6cbc6-26d5-4138-be20-78d2156426bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ian,As you are almost certainly on Windows, change the single quotes to double quotes as Windows doesn't process single quotes in any meaningful way.
gam user xx...@xxx.com delete messages query "label:Draft older_than:100d"
Yes, a draft in the trash still has the label DRAFT so modify your query:
On Wed, Jun 5, 2019 at 7:23 AM Ian Bevan <ian....@cset.co.uk> wrote:
Running gam user xx...@xxx.com delete messages query 'label:Draft older_than:100d'
Gives me an error of: ERROR: older_than:100d' is not a valid argument for "gam <users> delete messagesI have since realised that it's not accurate anyway. It's picking up >10k drafts for one of my users who has none now.
If the draft is sent to trash, does the label Draft stick with it?
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/92a6cbc6-26d5-4138-be20-78d2156426bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Ross Scroggs