Removing a label by querying for messages with the label

87 views
Skip to first unread message

Karl Piller

unread,
May 12, 2022, 8:00:36 PM5/12/22
to GAM for Google Workspace
Using GAM Advanced.

gam user test...@domain.org modify messages query label:mylabel removelabel mylabel  maxtomodify 1 doit

When I do this if the label exits it says "Label name exists or conflicts"
If I run it with a label that does not exist just to test it and see what happens it creates the label.
show messages query label:mylabel  works just fine but when I modify it is like it is trying to make the label.

Even when I used a different query like From or Subject it still seems to want to create the label.

I just want to query all messages with that label and remove it.

Thanks!

James SEYMOUR

unread,
May 12, 2022, 8:08:35 PM5/12/22
to GAM for Google Workspace
Hi Karl,

My notes has a command as gam user <User Email Address> modify messages query "label:<Label Name>" removelabel <Label Name> maxtomodify 1000000 doit. There are quotes around the lable query and the maxtomodify number is large.

Not sure if these 2 changes will help you.

Cheers

James

Ross Scroggs

unread,
May 13, 2022, 3:09:24 AM5/13/22
to google-ap...@googlegroups.com
Karl,

$ gam user testsimple show messages query "label:X" showlabels
Getting all Messages for tests...@domain.com
Got 2 Messages...
User: tests...@domain.com, Show 2 Messages
  Message: 18070c59a29954a6 (1/2)
    Date: Thu, 28 Apr 2022 08:23:57 -0700
    Subject: Re: Test 2
    From: Ross Scroggs <ross.s...@domain.com>
    To: Test Simple <tests...@domain.com>
    Delivered-To: tests...@domain.com
    Content-Type: multipart/alternative; boundary="Apple-Mail=_12B9C73E-EC6E-4D49-820F-6FEAC05DF246"
    Labels: IMPORTANT,X,CATEGORY_PERSONAL
  Message: 17fffe1fdd0e2c31 (2/2)
    Date: Wed, 6 Apr 2022 10:17:38 -0700
    Subject: Test 2
    From: Ross Scroggs <ross.s...@domain.com>
    Delivered-To: tests...@domain.com
    Content-Type: multipart/alternative; boundary="Apple-Mail=_DF2E2EAC-5FD8-43FD-B882-5B7F2546A398"
    Labels: CATEGORY_FORUMS,X

$ gam user testsimple modify messages query "label:X" removelabel X maxtomodify 2 doit
Getting all Messages for tests...@domain.com
Got 2 Messages...
User: tests...@domain.com, Modify 2 Messages
  User: tests...@domain.com, Message: 18070c59a29954a6, Modified (1/2)
  User: tests...@domain.com, Message: 17fffe1fdd0e2c31, Modified (2/2)

$ gam user testsimple show messages query "label:X" showlabels
Getting all Messages for tests...@domain.com
Got 0 Messages...
User: tests...@domain.com, Messages: 0, Not Shown: No Messages matched

What is: gam version

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/a9cb02e3-0654-4123-81a7-91fe0f90d315n%40googlegroups.com.

Ross Scroggs

unread,
May 13, 2022, 3:09:24 AM5/13/22
to google-ap...@googlegroups.com
Karl,

You need to upgrade, this was a bug fixed 8 months ago. The current version is 6.22.03.

6.07.11

Fixed bug in `gam <UserTypeEntity> modify messages|threads removelabel <LabelName>` where `<LabelName>`
was being created inappropriately.

Ross


On May 12, 2022, at 5:00 PM, Karl Piller <kpi...@rvtd.org> wrote:

Ross Scroggs

unread,
May 13, 2022, 3:09:33 AM5/13/22
to google-ap...@googlegroups.com
Karl,

Upgrade the software, then do:
gam update project
gam oauth create
gam user us...@domain.com check serviceaccount     (substitute a vaild address for us...@domain.com)

Ross

Karl Piller

unread,
May 13, 2022, 4:24:00 PM5/13/22
to GAM for Google Workspace
Ross, thank you for responding!
Yes I was back at 5.2 and upgrading resolved the issue with the label conflict/trying to create one.
Sry to have missed that I was not up to date!! Guess I was used to the old notification nag but I'm glad that update nag is gone these days.

I'm all good now and thank you so much for your continued work!


Working with system labels forums, promotions, updates, social found I had to include "category" for removelabel but had to leave it off for the query.
gam user testuser modify messages query "label:forums" removelabel category_forums maxtomodify 1000000 doit

In case anyone else sees this.
Reply all
Reply to author
Forward
0 new messages