I want to delete the Top label along with sub-labels and the content inside them

189 views
Skip to first unread message

Firdaus Jahan

unread,
Jul 13, 2023, 8:25:33 AM7/13/23
to GAM for Google Workspace
Urgent help needed!!!

I want to delete the Top label along with sub-labels and the content inside them. I am trying the following command 

gam user us...@email.com delete messages query "in:Root_Label" max_to_delete 10000 doit

but this is deleting all emails in root label along with sub-labels. and labels remain. As there are hundreds of unwanted labels I want to delete all along with content.
Note: This needs to be run from backend for 50 users.

Kindly suggest.

Thanks in advance

Ross Scroggs

unread,
Jul 13, 2023, 11:54:34 AM7/13/23
to google-ap...@googlegroups.com
Firdaus,

You deleted the messages, now you have to delete the labels.


gam user us...@email.com delete labels "regex:Root_Label.*"

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/ea79b737-8fcc-4c5a-9169-d8e032e46cc0n%40googlegroups.com.


--

Firdaus Jahan

unread,
Jul 14, 2023, 2:07:19 AM7/14/23
to GAM for Google Workspace
Thank you so much Ross. It worked as expected.

Firdaus Jahan

unread,
Jul 14, 2023, 10:35:59 PM7/14/23
to google-ap...@googlegroups.com
Hey Ross,
I would like to know how to delete nested labels.
The following is not giving same result for all users-

gam user email_id delete messages query "in:label" max_to_delete 10000 doit


Quick response is highly appreciated.

Thank you 


--
LOGO

Firdaus Jahan
Lead - Work Transformation
Econz IT Services Private Limited

9836156600 email fird...@econz.net
INDIA | Europe | Middle East

facebook instagram linkedin Twitter youtube

footer

Ross Scroggs

unread,
Jul 14, 2023, 11:13:50 PM7/14/23
to google-ap...@googlegroups.com
That command is deleting messages, not labels; My previous message showed how to delete labels.

Ross
----
Ross Scroggs



Ajo Jose

unread,
Jul 15, 2023, 12:11:17 AM7/15/23
to GAM for Google Workspace
Hi Ross,

Does this 10000 count can be increased, what is the maximum number of emails that we could delete in one go.

Ross Scroggs

unread,
Jul 15, 2023, 12:37:07 AM7/15/23
to google-ap...@googlegroups.com
Type as big a number as you want
----
Ross Scroggs



Ajo Jose

unread,
Jul 15, 2023, 12:41:16 AM7/15/23
to GAM for Google Workspace
Cool,thanks

Firdaus Jahan

unread,
Jul 15, 2023, 3:12:48 AM7/15/23
to google-ap...@googlegroups.com
Hey Ross,
Sorry my bad. I meant the command the not deleting messages from nested labels.
Can you help me with the command where all messages can be deleted from nested labels.
For eg- structure is
Root_Label
Child-Label-a
Child-Lable-b

In some cases we have hundreds of nested labels.


Regards,
Firdaus

Ross Scroggs

unread,
Jul 15, 2023, 10:42:40 PM7/15/23
to google-ap...@googlegroups.com
gam redirect csv ./LabelledMessages.csv user us...@domain.com print messages labelmatchpattern "Root_Label.*" headers message-id
gam user us...@domain.com delete messages ids csvfile ./LabelledMessages.csv:id
----
Ross Scroggs



Firdaus Jahan

unread,
Jul 16, 2023, 2:33:01 AM7/16/23
to google-ap...@googlegroups.com
Hi Ross,
Could you please explain or if possible can we please connect over Meat call to do this?
You can let me know your availability. If possible, I will share the meeting invite with your gmail ID.

Regards,
Firdaus

Ross Scroggs

unread,
Jul 16, 2023, 4:13:13 PM7/16/23
to google-ap...@googlegroups.com

gam redirect csv ./LabelledMessages.csv user us...@domain.com print messages labelmatchpattern "Root_Label.*" headers message-id

2) Delete those message

gam user us...@domain.com delete messages ids csvfile ./LabelledMessages.csv:id

Ross
----
Ross Scroggs


Firdaus Jahan

unread,
Jul 18, 2023, 11:07:57 AM7/18/23
to google-ap...@googlegroups.com
Thanks Ross. It worked 

Reply all
Reply to author
Forward
0 new messages