Gam Command to update photo's with CSV File

1,644 views
Skip to first unread message

Doug Roehm

unread,
Sep 2, 2017, 1:50:55 PM9/2/17
to GAM for G Suite
Trying to update pictures on our google domain

Not sure why this would happen but:

if I run the command
gam user joea...@domain.com update photo c:\googlepic\1234.jpg .... it works just fine

from the same computer if I run:
gam csv testfile.csv gam user ~email update photo ~photofile ... I get the following error:
ERROR 403: not authorized to access this resource/api - forbidden

the csv file has 2 fields:; one column named email and 1 column named photofile (ie joea...@domain.com, c:\photo\1315.jpg)

any ideas on why I get this message using a csv file but dont get it when using a command line for each user

Ross Scroggs

unread,
Sep 2, 2017, 5:12:05 PM9/2/17
to google-ap...@googlegroups.com
Doug,

This works for me. Is this all of the output?
gam csv testfile.csv gam user ~email update photo ~photofile
ERROR 403: not authorized to access this resource/api - forbidden

I would expect something like this:
c:\GamTest>gam csv testfile.csv gam user ~email update photo ~photofile
Using 3 processes...
Updating photo for test...@rdschool.org with c:\Photo\test...@rdschool.org.jpg (1/1)
Updating photo for test...@bogus.com with c:\Photo\test...@rdschool.org.jpg (1/1)
Updating photo for test...@rdschool.org with c:\Photo\test...@rdschool.org.jpg (1/1)

ERROR: 403: Not Authorized to access this resource/api - forbidden

c:\GamTest>

Now the question is, for whom did the error message apply? So, we serialize:

c:\GamTest>set GAM_THREADS=1

c:\GamTest>gam csv testfile.csv gam user ~email update photo ~photofile
Using 1 processes...
Updating photo for test...@rdschool.org with c:\Photo\test...@rdschool.org.jpg (1/1)
Updating photo for test...@bogus.com with c:\Photo\test...@bogus.com.jpg (1/1)

ERROR: 403: Not Authorized to access this resource/api - forbidden
Updating photo for test...@rdschool.org with c:\Photo\test...@rdschool.org.jpg (1/1)

c:\GamTest>

Aha! The invalid user is revealed.

By using my advanced Gam (https://github.com/taers232c/GAMADV-X) you don't have to serialize,
you'll get an error message indicating the invalid user.

c:\GamTest>gam redirect stdout - multiprocess csv testfile.csv gam user ~email update photo ~photofile
Using 3 processes...
User: test...@bogus.com, Service not applicable/Does not exist
User: test...@rdschool.org, Photo: c:\Photo\test...@rdschool.org.jpg, Updated
User: test...@rdschool.org, Photo: c:\Photo\test...@rdschool.org.jpg, Updated

c:\GamTest>

This "redirect stdout - multiprocess" tells advanced Gam to intelligently merge the output from all of the processes.

Ross
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/4c40f917-8fd1-4d9d-afcc-2c3e13c62912%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ross Scroggs

unread,
Sep 2, 2017, 5:32:15 PM9/2/17
to google-ap...@googlegroups.com
Doug,

With advanced GAM you can also redirect the output to a file if there are too many users to scan as the output rolls by.
c:\GamTest>gam redirect stdout ./PhotoUpdate.out  multiprocess redirect stderr stdout csv testfile.csv gam user ~email update photo ~photofile
Using 3 processes...

c:\GamTest>more PhotoUpdate.out
User: test...@pacbell.net, Service not applicable/Does not exist
User: test...@rdschool.org, Photo: c:\Photo\test...@rdschool.org.jpg, Updated
User: test...@rdschool.org, Photo: c:\Photo\test...@rdschool.org.jpg, Updated
Using 3 processes...

c:\GamTest>

Ross

On Sat, Sep 2, 2017 at 2:11 PM, Ross Scroggs <ross.s...@gmail.com> wrote:
Doug,

This works for me. Is this all of the output?
gam csv testfile.csv gam user ~email update photo ~photofile
ERROR 403: not authorized to access this resource/api - forbidden

I would expect something like this:
c:\GamTest>gam csv testfile.csv gam user ~email update photo ~photofile
Using 3 processes...
Updating photo for test...@rdschool.org with c:\Photo\testuser1@rdschool.org.jpg (1/1)
Updating photo for test...@bogus.com with c:\Photo\testuser9@rdschool.org.jpg (1/1)
Updating photo for test...@rdschool.org with c:\Photo\testuser2@rdschool.org.jpg (1/1)

ERROR: 403: Not Authorized to access this resource/api - forbidden

c:\GamTest>

Now the question is, for whom did the error message apply? So, we serialize:

c:\GamTest>set GAM_THREADS=1

c:\GamTest>gam csv testfile.csv gam user ~email update photo ~photofile
Using 1 processes...
Updating photo for test...@rdschool.org with c:\Photo\testuser1@rdschool.org.jpg (1/1)
Updating photo for test...@bogus.com with c:\Photo\test...@bogus.com.jpg (1/1)

ERROR: 403: Not Authorized to access this resource/api - forbidden
Updating photo for test...@rdschool.org with c:\Photo\testuser2@rdschool.org.jpg (1/1)

c:\GamTest>

Aha! The invalid user is revealed.

By using my advanced Gam (https://github.com/taers232c/GAMADV-X) you don't have to serialize,
you'll get an error message indicating the invalid user.

c:\GamTest>gam redirect stdout - multiprocess csv testfile.csv gam user ~email update photo ~photofile
Using 3 processes...
User: test...@bogus.com, Service not applicable/Does not exist
User: test...@rdschool.org, Photo: c:\Photo\testuser1@rdschool.org.jpg, Updated
User: test...@rdschool.org, Photo: c:\Photo\testuser2@rdschool.org.jpg, Updated

c:\GamTest>

This "redirect stdout - multiprocess" tells advanced Gam to intelligently merge the output from all of the processes.

Ross
On Sep 2, 2017, at 10:35 AM, Doug Roehm <roe...@gmail.com> wrote:

Trying to update pictures on our google domain

Not sure why this would happen but:

if I run the command
gam user joea...@domain.com update photo c:\googlepic\1234.jpg .... it works just fine

from the same computer if I run:
gam csv testfile.csv gam user ~email update photo ~photofile ... I get the following error:
ERROR 403: not authorized to access this resource/api - forbidden

the csv file has 2 fields:; one column named email and 1 column named photofile (ie joea...@domain.com, c:\photo\1315.jpg)

any ideas on why I get this message using a csv file but dont get it when using a command line for each user

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.




--

Jay Lee

unread,
Sep 2, 2017, 6:35:29 PM9/2/17
to google-ap...@googlegroups.com
The error message indicates you may be trying to modify either a non existent user or one not in your domain. Check the csv for typos.

Jay

--

Doug Roehm

unread,
Sep 2, 2017, 10:51:34 PM9/2/17
to GAM for G Suite
thanks all... found the issue.. the csv file had a trailing blank space at end of the email address for each user.. removed the trailing blanks and all works just fine
Reply all
Reply to author
Forward
0 new messages