Delete all files from an account: Email, drive, photos

1,422 views
Skip to first unread message

Junio Custodio da Silva

unread,
Jul 26, 2022, 10:53:23 AM7/26/22
to GAM for Google Workspace

Good morning!

I wonder if it is possible to delete all files from an account. Ex: Clear email, photos and drive.
The goal would be to clear all suspended accounts.

Thanks!

Iain Macleod

unread,
Jul 27, 2022, 4:41:43 PM7/27/22
to GAM for Google Workspace
At that point why not just delete the suspended accounts? Surly if you have deleted all the data there is no reason to hold onto the account? 

Junio Custodio da Silva

unread,
Jul 27, 2022, 5:06:27 PM7/27/22
to google-ap...@googlegroups.com
Hi

These are accounts of graduating students


Notice to recipient: This e-mail is only meant for the intended recipient of the transmission, and may be a confidential communication or a communication privileged by law. If you received this e-mail in error, any review, use, dissemination, distribution, or copying of this e-mail is strictly prohibited. Please notify us immediately of the error by return e-mail and please delete this message from your system. Thank you in advance for your cooperation.

--
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/9a2e88f5-c23a-492b-9e59-ce8fccd2ff53n%40googlegroups.com.


--

Junio Custódio da Silva
Analista de Redes de Computadores
Gerência de Infraestrutura de Redes

(61) 3966-1510 / 3966-1271 |  ceub.br

Iain Macleod

unread,
Jul 27, 2022, 5:29:58 PM7/27/22
to GAM for Google Workspace
I am assuming you have GAMADV-XTD3, if not you can upgrade see here: https://github.com/taers232c/GAMADV-XTD3/wiki/How-to-Upgrade-from-Standard-GAM

For mail:

You might be able to get away with just a delete command like this, but I haven't tested.
     gam user [UserEmail] delete messages doit

IF that does not work, go with gathering the emails for the user in a CSV then using that to delete them all

First print all the messages a user has to a csv file.
     gam redirect csv ./messages.csv user [UserEmail] print messages

Then delete all those messages from their inbox.
     gam multiprocess csv ./messages.csv gam user [UserEmail] delete messages query "~id" doit

For Drive: 
See Method 2 on this page 

For Photos, you are out of luck, there is no API for Google Photos that can help as far as I know. IF anyone has any ideas please share. 

Ross Scroggs

unread,
Jul 27, 2022, 5:38:49 PM7/27/22
to google-ap...@googlegroups.com
Comments on Iain's suggestion:
This won't work
     gam user [UserEmail] delete messages doit

IF that does not work, go with gathering the emails for the user in a CSV then using that to delete them all

First print all the messages a user has to a csv file.
     gam redirect csv ./messages.csv user [UserEmail] print messages

Delete the messages directly by id:
Then delete all those messages from their inbox.
     gam multiprocess csv ./messages.csv gam user [UserEmail] delete messages ids "~id"

Ross

Iain Macleod

unread,
Jul 27, 2022, 5:40:02 PM7/27/22
to GAM for Google Workspace
Correction on the Mail deleting from CSV I missed a bit, see it here in bold

  gam multiprocess csv ./messages.csv gam user [UserEmail] delete messages query "rfc822msgid:~Message-ID" doit

Iain Macleod

unread,
Jul 27, 2022, 5:49:15 PM7/27/22
to GAM for Google Workspace
Looks like Ross got to it before me, please disregard my last email. 
Reply all
Reply to author
Forward
0 new messages