Deleting emails by subject with multiple colons

10 views
Skip to first unread message

Mary Barber

unread,
Jan 28, 2026, 10:21:10 AM (5 days ago) Jan 28
to GAM for Google Workspace
Good morning!

I am having difficulties deleteing emails by subject when the subject contains multiple colons. I used to be able to put a single quote around the subject line but that now gives me an error. 

gam all users delete messages query "Subject:\'Document shared with you: "Important Notice:Payroll Increase.docx"' after:2026/01/25" max_to_delete 1 doit

gives me an error Notice:Payroll is not a valid argument for "gam <users> delete messages" 

We are finding most of our attempted phishing is now coming in the form of Document shares and would love to be able to remove these emails from our users' inboxes and maybe also the docs from their Google Drive (if anyone knows the command for that too?) 

Thanks in advance!


Ross Scroggs

unread,
Jan 28, 2026, 10:24:43 AM (5 days ago) Jan 28
to google-ap...@googlegroups.com
Mary,

The quoting is off; are you on:
MacOS
Linus
Windows Command Prompt
Windows Powershell

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/3c86d0b8-7dfa-4c53-899a-932bee3c53bdn%40googlegroups.com.

Mary Barber

unread,
Jan 28, 2026, 10:29:18 AM (5 days ago) Jan 28
to google-ap...@googlegroups.com
Windows Command Prompt

You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/wH7bLPIlkyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/60A2F81B-DAB0-467E-AA2C-A78A1D6193FB%40gmail.com.


--
Mary Barber
Data Integration Specialist
Clinton Public Schools
Technology Dept hours are 7:00-3:30 M-F
currently listening to: Gustav Holst

CONFIDENTIALITY NOTICE: This e-mail and the documents accompanying this e-mail may contain confidential information belonging to the sender which is legally privileged. The information is intended only for the use of the individual or entity named above as recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on or regarding the contents of this e-mailed information is strictly prohibited. If you have received this e-mail in error, please notify me immediately by telephone.

Ross Scroggs

unread,
Jan 28, 2026, 10:34:05 AM (5 days ago) Jan 28
to google-ap...@googlegroups.com
Try:
gam all users delete messages query "Subject:'Document shared with you: \"Important Notice:Payroll Increase.docx\"' after:2026/01/25" max_to_delete 1 doit

Ross
----
Ross Scroggs


Mary Barber

unread,
Jan 28, 2026, 11:41:12 AM (5 days ago) Jan 28
to google-ap...@googlegroups.com
Thank you so much for your help today Ross! We updated my GAM, got all the quotes placed correctly for Windows Command Prompt and also set it to batch and filter by our specific suborgs.

gam config num_threads 20 auto_batch_min 1 redirect stdout - multiprocess redirect stderr stdout ous_and_children "'/Faculty and Staff','tech org'" delete messages query "Subject:'Document shared with you: \"Important Notice:Payroll Information.docx\"' after:2026/01/25" max_to_delete 10 doit

Try:
CONFIDENTIALITY NOTICE: This e-mail and the documents accompanying this e-mail may contain confidential information belonging to the sender which is legally privileged. The information is intended only for the use of the individual or entity named above as recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on or regarding the contents of this e-mailed information is strictly prohibited. If you have received this e-mail in error, please notify me immediately by telephone.

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/CAGwnX6uYSZnw9kAFG%2BkHEeUNTw1p%3DqTz-jqpCEF%3DHLXqErBvNw%40mail.gmail.com.

--
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/wH7bLPIlkyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages