Archive mail with specific label

136 views
Skip to first unread message

Lili

unread,
Jul 12, 2022, 1:07:21 PM7/12/22
to GAM for Google Workspace
Hi all, 

Does anyone know how to archive mail with a specific label in Gmail?

Thanks,  

 
 
---------------------------------------------------------------
THIS IS A TEST ACCOUNT.  THIS IS A TEST DOMAIN.  Please do not send, receive, or add production data to this email and/or domain.  This account and domain are for instructional purposes only. Tempus Nova, Inc. makes no warranties or representations whatsoever regarding the quality, content, completeness, suitability, adequacy, sequence, accuracy, or timeliness of any information and data contained in this email and that exists in this entire test domain.

Ross Scroggs

unread,
Jul 12, 2022, 1:47:32 PM7/12/22
to google-ap...@googlegroups.com
Lili,


gam user us...@domain.com archive messages gr...@domain.com query "label:xxxx" max_to_archive 100000 doit

Ross

--
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 on the web visit https://groups.google.com/d/msgid/google-apps-manager/dccb5790-fce4-4bca-a570-ce07e691c041n%40googlegroups.com.


--

Jay Lee

unread,
Jul 12, 2022, 2:15:22 PM7/12/22
to google-ap...@googlegroups.com, Ross Scroggs
Archiving in Gmail is simply removing the INBOX label from the message so this is the same thing and should work for all versions:

gam user us...@domain.com modify messages query "label:xxxx in:inbox" remove_label INBOX max_to_modify 100000 doit

@Ross Scroggs it's not clear to me what gr...@domain.com is doing in your command.

Adding in:inbox to the command will speed up the process by ensuring we're only making API calls to modify messages that aren't already archived.

Jay


Reply all
Reply to author
Forward
0 new messages