Apply a Label to all emails

30 views
Skip to first unread message

Admin

unread,
Jul 10, 2026, 10:27:57 AM (9 days ago) Jul 10
to google-ap...@googlegroups.com
Hi Team,

I need to apply an existing label to all messages within a user's mailbox. I tried the GAM commands listed below, but they aren't working as expected and are returning zero matched messages. Could someone help me with the correct query to target "All Mail"?  

image.png

I tried the below two commands as well but it just applies the label for a handful of emails not all.

gam user X...@XXX.com modify messages query "before:tomorrow" addlabel "_ 🔏Archive - Do Not Alter" maxtomodify 10000000 doit 2> failures.txt

gam user  X...@XXX.com    modify messages query "anywhere" addlabel "_ 🔏Archive - Do Not Alter" maxtomodify 10000000 doit 2> failures.txt

Let me know if someone can help.

Ross Scroggs

unread,
Jul 10, 2026, 12:27:40 PM (9 days ago) Jul 10
to google-ap...@googlegroups.com
Try: gam user  X...@XXX.com    modify messages query "in:anywhere" addlabel "_ 🔏Archive - Do Not Alter" maxtomodify 10000000 doit 2> failures.txt

Ross

----
Ross Scroggs



On Jul 10, 2026, at 7:27 AM, Admin <please...@gmail.com> wrote:

Hi Team,

I need to apply an existing label to all messages within a user's mailbox. I tried the GAM commands listed below, but they aren't working as expected and are returning zero matched messages. Could someone help me with the correct query to target "All Mail"?  

<image.png>

I tried the below two commands as well but it just applies the label for a handful of emails not all.

gam user X...@XXX.com modify messages query "before:tomorrow" addlabel "_ 🔏Archive - Do Not Alter" maxtomodify 10000000 doit 2> failures.txt

gam user  X...@XXX.com    modify messages query "anywhere" addlabel "_ 🔏Archive - Do Not Alter" maxtomodify 10000000 doit 2> failures.txt

Let me know if someone can help.

--
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/CANMyvr%3D9y9bLEqGZ5Uou%3D9EhaZqkWmeNLRQ_a1h%2Bz8S-b5Fe8A%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages