Unable to delete messages in GAM7

33 views
Skip to first unread message

Scott Stahl

unread,
Jan 30, 2026, 12:57:40 PM (3 days ago) Jan 30
to GAM for Google Workspace
Howdy!

I'm having issues trying to delete/trash messages on several versions of GAM7, including the most current.  The sample command I'm using for troubleshooting is:

gam user acc...@domain.com trash messages query before:2024-01-01

Even though there are thousands of messages to purge, the return is always as follows:
Got 1 Message for  acc...@domain.com  ...
User:  acc...@domain.com, Message: 1, Not Trashed: Use the "doit" argument to perform action

I can run the command successfully from a shared script server running GAM 6.1

My first assumption is a rights issue.  If I run "gam user <me> check serviceaccount", I do get some differences, but the key rights are 'passing':
Non-working install
   https://www.googleapis.com/auth/gmail.modify                              PASS (33/42)
   https://www.googleapis.com/auth/gmail.settings.basic                      PASS (34/42)
   https://www.googleapis.com/auth/gmail.settings.sharing                    PASS (35/42)
Working install
  https://www.googleapis.com/auth/gmail.settings.basic                       PASS
  https://www.googleapis.com/auth/gmail.settings.sharing                     PASS

The command to print messages with the same query works fine on both platforms/versions.  Only the trash/delete errors out.

Please do not reply with 'use the script server'.  I'm remote and do not always have access to the shared script server so I need my local install to be effective.

I appreciate any pointers for further troubleshooting.

Thanks!



CONFIDENTIALITY NOTICE:
This email message and any accompanying data or files is confidential and may contain privileged information intended only for the named recipient(s). If you are not the intended recipient(s), you are hereby notified that the dissemination, distribution, and or copying of this message is strictly prohibited. If you receive this message in error, or are not the named recipient(s), please notify the sender at the email address above, delete this email from your computer, and destroy any copies in any form immediately. Receipt by anyone other than the named recipient(s) is not a waiver of any attorney-client, work product, or other applicable privilege.

Ross Scroggs

unread,
Jan 30, 2026, 2:47:51 PM (3 days ago) Jan 30
to google-ap...@googlegroups.com
See: https://github.com/GAM-team/GAM/wiki/Users-Gmail-Messages-Threads#manage-a-selected-set-of-messages

gam user acc...@domain.com trash messages query before:2024-01-01 max_to_trash N doit

Replace N with 0 to trash all matching messages, or some postive integer to limit the number of messages trashed.

Rpss

----
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/3a5ed4b2-440a-4968-a286-090e966c793fn%40googlegroups.com.

Scott Stahl

unread,
Jan 30, 2026, 4:42:24 PM (3 days ago) Jan 30
to GAM for Google Workspace
Thank you.  I did find that in the docs yesterday:
  • max_to_xxx - Limit the number of messages that will be displayed
  • includespamtrash - Include messages in the Spam and Trash folders
I interpreted it to mean max_to_100, not max_to_trash 100

Reply all
Reply to author
Forward
0 new messages