Can't match the guardian invite to the student.

71 views
Skip to first unread message

heidi.h

unread,
Sep 22, 2017, 3:42:14 AM9/22/17
to GAM for G Suite



Hi,
I ran this command:
gam print guardians invitations states PENDING todrive




And got this output with no Student Email (Guardian Email was fine). Is it possible to get the Student Email somehow?
Can I download a list of students and their student ID and match them up?
I am using GAM 4.30.

Thanks
Thanks

Ben Houseward

unread,
Mar 1, 2018, 1:13:28 PM3/1/18
to GAM for G Suite
I ran into something similar today. I was asked to find out about the usage of the guardian feature in our HS, MS, and EL campuses. I ran 
gam print guardians states COMPLETE

Which gives me a similar list of guardian emails and studentIds, but no email address. I can use the studentId in a command like this:
gam print guardians student id:102596714475361774281
gam show guardian student id:102596714475361774281

Which basically gives me the same information as the first command, but when I try to use the studentId in a command like this:
gam print courses student id:102596714475361774281

I get ERROR: 400: Request contains an invalid argument. - badRequest

I can't seem to make any use of the studentId to determine which students a guardian has access to, and therefore which campus the student belong to. 

Is there a way to determine which students a guardian has access to? Or ideally a way to populate that studentEmail field in the results? Even a list of studentIds and student email addresses like Heidi requested would suffice.

Thanks!

Ben Houseward

unread,
Mar 1, 2018, 1:58:09 PM3/1/18
to GAM for G Suite
Ok, I just ran across this post which states that the emailAddress doesn't come back from the API. Bummer. 

It looks like it would be possible with a whole lot of commands to figure this out since the same studentId is displayed using this command:
gam print course-participants course 21125351

Which of course assumes we know the course for which the student has a guardian assigned. 
We could generate a list of all course-student combinations with a csv of 
gam print courses student <student email>
or 
gam print courses teacher <teacher email>

Then trimming out all the courseIds and running another csv gam command with 
gam print course-participants course <courseId>

and lastly comparing the resulting StudentIds with those found in 
gam print guardians states COMPLETE 
or in the case of the OP
gam print guardians invitations states PENDING

to finally identify the students that are paired with their guardians.

Ross Scroggs

unread,
Mar 2, 2018, 11:44:30 AM3/2/18
to google-ap...@googlegroups.com
Ben,

Two solutions.
I wrote a script that will take an input file of student ids/emails and an input file of guardians and output an updated guardians file with the student emails.
Python 2: https://github.com/taers232c/GAM-Scripts GetGuardianStudentEmails.py
Python 3: https://github.com/taers232c/GAM-Scripts3 GetGuardianStudentEmails.py

I also updated my Advanced GAM (https://github.com/taers232c/GAMADV-Xhttps://github.com/taers232c/GAMADV-X/wiki/GAM-Updates) to write the student emails as part of the print guardian commands. However, this requires an additional API call per guardian so it can be expensive for large number of guardians.

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-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@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/781c3fcf-2c24-4b9a-8b83-af67c6732ba4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Ben Houseward

unread,
Mar 2, 2018, 12:33:45 PM3/2/18
to GAM for G Suite
Thanks Ross! I was able to get the information I needed with my method and some guesswork on which classes were involved which cut down my time, but your solutions look much more elegant. Next time I have an occasion to do this I will reference this again, and I'll definitely take a look at what else GAMADV-X has to offer.

Thanks!
Ben
Reply all
Reply to author
Forward
0 new messages