Mass deletion of all messages prior to a chosen date for a single user

66 views
Skip to first unread message

BCNCOM

unread,
Sep 27, 2024, 1:08:14 PM9/27/24
to GAM for Google Workspace
Is it possible to  script a mass deletion of all messages prior to a chosen date for a single user?

We've got a client with a 100GB mailbox. She wants to bring this down to about 25GB, but doesn't have to go through it manually. If we could somehow automate removal of messages older than a date she chooses, this would speed things up dramatically.

Ross Scroggs

unread,
Sep 27, 2024, 1:29:46 PM9/27/24
to google-ap...@googlegroups.com
See: https://support.google.com/mail/answer/7190

gam user us...@domain.com delete messages query "before:yyyy/mm/dd" maxtodelete 100000000

Ross
----
Ross Scroggs



On Sep 27, 2024, at 10:08 AM, 'BCNCOM' via GAM for Google Workspace <google-ap...@googlegroups.com> wrote:

Is it possible to  script a mass deletion of all messages prior to a chosen date for a single user?

We've got a client with a 100GB mailbox. She wants to bring this down to about 25GB, but doesn't have to go through it manually. If we could somehow automate removal of messages older than a date she chooses, this would speed things up dramatically.

--
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/021c9efb-73ac-446d-84e0-397539947335n%40googlegroups.com.

Brian Cross

unread,
Sep 27, 2024, 1:31:29 PM9/27/24
to google-ap...@googlegroups.com
Great, wasn't sure if GAMadv supported that query or not! Much appreciated!

Brian Cross
Support Tech Level 2

bcr...@nutmegit.com

(860) 256-4822 x714

---------------------------------------------------------------------------------------------

On the Web: Nutmegit.com | Facebook | Linkedin

Featured Solutions:
LightSwitch Lighting the Way to Better Network Management
HMIS Consulting – Experienced HMIS Consulting and Professional Services



On Fri, Sep 27, 2024 at 1:29 PM Ross Scroggs <ross.s...@gmail.com> wrote:
See: https://support.google.com/mail/answer/7190 gam user us...@domain.com delete messages query "before:yyyy/mm/dd" maxtodelete 100000000 Ross ---- Ross Scroggs Ross.S...@gmail.com On Sep 27, 2024,
sophospsmartbannerend
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/1zzPTbk8zcs/unsubscribe.
To unsubscribe from this group and all its topics, 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/88F4E5FF-EEC1-4FE9-8298-9A76B5CBE82F%40gmail.com.

Kassi Taylor

unread,
Sep 27, 2024, 1:46:12 PM9/27/24
to google-ap...@googlegroups.com
What is it supposed to  look like I got this 
Screenshot 2024-09-27 at 1.44.57 PM.png

Ross Scroggs

unread,
Sep 27, 2024, 1:55:39 PM9/27/24
to google-ap...@googlegroups.com
Scroll down the page to see all of the possible query clauses
You'll find these: 
Search for emails sent during a certain time period.
Search for emails older or newer than a time period. Use d (day), m (month), or y (year).

Ross
----
Ross Scroggs


On Sep 27, 2024, at 10:45 AM, Kassi Taylor <kassita...@gmail.com> wrote:

What is it supposed to  look like I got this 

Kassi Taylor

unread,
Sep 27, 2024, 2:03:38 PM9/27/24
to google-ap...@googlegroups.com

BCNCOM

unread,
Sep 27, 2024, 2:15:05 PM9/27/24
to GAM for Google Workspace
Hmmmm. GAM is saying that "maxtodelete" is an invalid argument:

2024-09-27_141403.png

I'm running v7.00.07.

Ross Scroggs

unread,
Sep 27, 2024, 2:29:17 PM9/27/24
to google-ap...@googlegroups.com
That's because you said trash messages rather than delete messages; use maxtotrash.

Ross
----
Ross Scroggs


On Sep 27, 2024, at 11:15 AM, 'BCNCOM' via GAM for Google Workspace <google-ap...@googlegroups.com> wrote:

Hmmmm. GAM is saying that "maxtodelete" is an invalid argument:

Brian Cross

unread,
Sep 27, 2024, 2:38:30 PM9/27/24
to google-ap...@googlegroups.com
Noticed it right after I posted; also forgot the underscores (max_to_trash). Thanks!

Now just figuring out how to log it properly and I should be good to go. Getting some "quotaExceeded - Resource has been exhausted (e.g. check quota)" errors, too, but I'm guessing that's a Google problem?

Brian Cross
Support Tech Level 2

bcr...@nutmegit.com

(860) 256-4822 x714

---------------------------------------------------------------------------------------------

On the Web: Nutmegit.com | Facebook | Linkedin

Featured Solutions:
LightSwitch Lighting the Way to Better Network Management
HMIS Consulting – Experienced HMIS Consulting and Professional Services



On Fri, Sep 27, 2024 at 2:29 PM Ross Scroggs <ross.s...@gmail.com> wrote:
That's because you said trash messages rather than delete messages; use maxtotrash. Ross ---- Ross Scroggs Ross.S...@gmail.com On Sep 27, 2024, at 11:15 AM, 'BCNCOM' via GAM for Google Workspace w
sophospsmartbannerend
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/1zzPTbk8zcs/unsubscribe.
To unsubscribe from this group and all its topics, 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/ACF4FB9C-6887-4117-9296-C7B5A6361F2A%40gmail.com.

Ross Scroggs

unread,
Sep 27, 2024, 3:15:31 PM9/27/24
to google-ap...@googlegroups.com
Send me a Meet/Zoom invitation if you'd like to discuss.

Ross
----
Ross Scroggs


Reply all
Reply to author
Forward
0 new messages