-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Google Classroom function bug collection #87
Comments
@IronKane2 - Tracking issues here |
For item 2, it looks like the Classroom API balks when trying to submit the request to list Courses in all of the valid CourseStates, which is why it was failing; default value is set to request all CourseStates, that has been removed in Dev. Also tested different combinations of CourseStates and here are the following that work:
For item 3, the calls to Add-Member have been removed from Get-GSCourseParticipant in Dev. Shouldn't have that issue once 2.14.1 comes out shortly. |
## 2.14.1 * [Issue #87](#87) * Removed `Add-Member` calls from `Get-GSCourseParticipant` to resolve item 3 on issue * Cleaned up `CourseStates` parameter on `Get-GSCourse` to validate against the Enum directly and removed the default parameter value to resolve item 2 on issue * Cleaned up `State` parameter on `Get-GSStudentGuardianInvitation` to validate against the Enum directly in an effort to prevent the same issue as item 2
@IronKane2 - PSGSuite v2.14.1 is available now on the Gallery with fixes for items 2 and 3. Please take note in my previous comment about CourseState clashes. |
I tried creating a new GSCourse and received an error about permission. Should there be a param for domain? I am our Google domain SA. I tested the account permissions by creating a new student. PS C:\Users> New-GSCourse -Name "Steve Test Class" -OwnerId srcampbell@ourdomain.net -Section s01 -Room "Secret Lab" -CourseState ACTIVE New-GSCourse : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError
|
Checking the scopes out on the function to make sure they're correct. Just
to confirm, you updated the API Client access per the Initial Setup doc and
included the bottom, separate section that includes the Classroom specific
scopes? Usually 403's like that happen because either the method being used
is accompanied by an incorrect scope or the exact scope being used hasn't
been specified for API Client Access.
[image: image.png]
…On Wed, Oct 3, 2018 at 10:03 AM IronKane2 ***@***.***> wrote:
I tried creating a new GSCourse and received an error about permission.
Should there be a param for domain? I am our Google domain SA. I tested the
account permissions by creating a new student.
PS C:\Users> New-GSCourse -Name "Steve Test Class" -OwnerId
***@***.*** -Section s01 -Room "Secret Lab" -CourseState
ACTIVE
New-GSCourse : Exception calling "Execute" with "0" argument(s):
"Google.Apis.Requests.RequestError
The caller does not have permission [403]
Errors [
Message[The caller does not have permission] Location[ - ]
Reason[forbidden] Domain[global]
]
"
At line:1 char:2
- New-GSCourse -Name "Steve Test Class" -OwnerId
***@***.*** ...
-
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-GSCourse
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#87 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMIo3aPXAP6OrSVdtl1IGSrIQPjJXhmbks5uhO3dgaJpZM4XDIQe>
.
|
Yes I did. I double checked before posting. Then created a user to make sure I had a good session going. |
Gotcha! Diving in! Thanks for continuing to pass these bumps along! |
@IronKane2 - Just checked the scope for |
also, confirmed that the scope for Let me know if any of the Other things to confirm:
|
Students are in a child domain, but it wasn't referenced in the New-GSCourse cmd I executed. I've been using the Get-GSCourse with no issues. I looked at the API Client Access again and it looks good. I was reading your 2nd link and my Admin Console has "Users can authorize apps to access their Google Classroom data." checked. Should that be unchecked? |
Gotcha! I think my takeaway from this is to add the User parameter to the
remainder of the Classroom functions for cases where your admin account may
not have the ability to do certain things like creating courses so you can
impersonate a user with the required level of access.
Glad to hear the Get-* commands are working without issue!
That specific setting shouldn't matter IMHO, but even so, I think leaving
it checked would be the better option anyway.
…On Thu, Oct 4, 2018 at 11:20 AM IronKane2 ***@***.***> wrote:
Students are in a child domain, but it wasn't referenced in the
New-GSCourse cmd I executed. I've been using the Get-GSCourse with no
issues. I looked at the API Client Access again and it looks good.
I was reading your 2nd link and my Admin Console has "Users can authorize
apps to access their Google Classroom data." checked. Should that be
unchecked?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#87 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMIo3YbuxGCa0GKb_KU3XjcKUAqwo7YFks5uhjVbgaJpZM4XDIQe>
.
|
@IronKane2 - v2.15.1 deploying now with the additional |
I finally got it to work. Not sure what I did. I was trading emails with one of the helpful staff at AmplifiedIT and added my account to the classroom_teachers group. That might be what fixed it. It wasn't immediate and I just happened to try one more time. Thanks again for your hard work on this. |
That's awesome to hear, @IronKane2! Any other issues that you've run into so far for the Classroom functions? |
Add-GSCourseParticipant : Cannot convert argument "body", with value: "student@uni.edu", for "Create" to type "Google.Apis.Classroom.v1.Data.Student": "Cannot convert the "student@uni.edu" value of type
"System.String" to type "Google.Apis.Classroom.v1.Data.Student"."
At line:1 char:1
+ Add-GSCourseParticipant -CourseId 19487328166 -Student student@uni. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-GSCourseParticipant |
Looking at https://developers.google.com/classroom/guides/manage-users |
@IronKane2 - You are correct, I was just about to respond as well. I'm on it! Keeping sending any over as you run across them 👍 |
Found the issue! It's creating the Student object, but it's passing the email as the body parameter to the |
I don't know if this is a bug, but Get-GSClassroomParticipants returns a Profile object with a email field that comes up blank. |
If you're still having issues on the latest version, can you send one of the resulting objects over so I can see what's being returned? The email/ID of the participant should be in the top-level |
sorry, I mis-typed.
|
I just spoke with my Director of Technology and she concurs about letting teachers remove students as a manual process on their end. Takes the target off of my back ;) |
Makes sense! Worst case scenario, you can use |
…, add Sync-GSUserCache for #87 ## 2.18.0 * [Issue #87](#87) * Added: `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` now have the `Fields` parameter * Added: `Sync-GSUserCache` to create a hashtable of users for quick lookups throughout scripts * [Issue #53](#53) via [PR #108](#108) - _Thanks, [@dwrusse](https://github.com/dwrusse)!_ * Added: `Get-GSContactList` * Added: `Remove-GSContact` * Other additions via [PR #108](#108) - _Thanks, [@dwrusse](https://github.com/dwrusse)!_ * Added: `Remove-GSCalendarEvent` * Added: `New-GSGmailLabel` * Added: `Remove-GSGmailLabel`
…, add Sync-GSUserCache for #87 ## 2.18.0 * [Issue #87](#87) * Added: `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` now have the `Fields` parameter * Added: `Sync-GSUserCache` to create a hashtable of users for quick lookups throughout scripts * [Issue #53](#53) via [PR #108](#108) - _Thanks, [@dwrusse](https://github.com/dwrusse)!_ * Added: `Get-GSContactList` * Added: `Remove-GSContact` * Other additions via [PR #108](#108) - _Thanks, [@dwrusse](https://github.com/dwrusse)!_ * Added: `Remove-GSCalendarEvent` * Added: `New-GSGmailLabel` * Added: `Remove-GSGmailLabel`
@IronKane2 - v2.18.0 with the Fields parameter on those 2 functions released! I also included
Usage: # Let it store in the global variable only
Sync-GSUserCache
$global:GSUserCache['user@domain.com'] # Gets the user object by primary email
$global:GSUserCache['u@domain.com'].PrimaryEmail # Gets a user's primary email via an alias
# Alternatively, include -PassThru and store it in a local variable as well
$hash = Sync-GSUserCache -PassThru
$hash['user@domain.com'] # Gets the user object by primary email
$hash['u@domain.com'].PrimaryEmail # Gets a user's primary email via an alias
# Supply a filter if you'd like to only sync a subset of users
$hash = Sync-GSUserCache -Filter "IsSuspended -eq '$false'"
$hash.Keys -contains 'activeuser@domain.com' # This would return True
$hash.Keys -contains 'suspendeduser@domain.com' # This would return false, even though it is a valid email in the domain |
For usage on the
They also vary when specifying sub-property fields:
I would try out something like the following and see what returns, what throws an error, etc: $t = (Get-GSCourse)[0]
# 1 - camelCase w/ top level fields only
Get-GSCourseParticipant -CourseId $t.Id -Fields id,profile,eTag
# 2 - camelCase w/ wildcard deeper field and slash separator
Get-GSCourseParticipant -CourseId $t.Id -Fields id,profile,'profile/*',eTag
# 3 - camelCase w/ specified deeper field and slash separator
Get-GSCourseParticipant -CourseId $t.Id -Fields id,profile,'profile/emailAddress',eTag
# 4 - camelCase w/ specified deeper field and dot separator
Get-GSCourseParticipant -CourseId $t.Id -Fields id,profile,'profile.emailAddress',eTag
# 5 - camelCase w/ wildcard deeper field and dot separator
Get-GSCourseParticipant -CourseId $t.Id -Fields id,profile,'profile.emailAddress',eTag
# 6 - PascalCase w/ top level fields only
Get-GSCourseParticipant -CourseId $t.Id -Fields Id,Profile,ETag
# 7 - PascalCase w/ wildcard deeper field and slash separator
Get-GSCourseParticipant -CourseId $t.Id -Fields Id,Profile,'Profile/*',ETag
# 8 - PascalCase w/ specified deeper field and slash separator
Get-GSCourseParticipant -CourseId $t.Id -Fields Id,Profile,'Profile/EmailAddress',ETag
# 8 - PascalCase w/ specified deeper field and dot separator
Get-GSCourseParticipant -CourseId $t.Id -Fields Id,Profile,'Profile.EmailAddress',ETag
# 8 - PascalCase w/ wildcard deeper field and dot separator
Get-GSCourseParticipant -CourseId $t.Id -Fields Id,Profile,'Profile.*',ETag |
I have a solution for Get-CourseParticipant not returning an email address. In $ServiceParams set the scope as @('https://www.googleapis.com/auth/classroom.rosters', 'https://www.googleapis.com/auth/classroom.profile.emails') |
@jdstanberry - thank you! Going to get this updated and another version pushed out ASAP. |
You can get the full profile with:
Scope = @('https://www.googleapis.com/auth/classroom.rosters', '
https://www.googleapis.com/auth/classroom.profile.emails', '
https://www.googleapis.com/auth/classroom.profile.photos')
…On Thu, Nov 8, 2018 at 9:57 AM Nate Ferrell ***@***.***> wrote:
@jdstanberry <https://github.com/jdstanberry> - thank you! Going to get
this updated and another version pushed out ASAP.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#87 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AnmWpZM4ztIShNCn0dnQUrVsA__u5H8lks5utGJ8gaJpZM4XDIQe>
.
--
Justin Stanberry
System Administrator
Palo Verde ESD
623.327.3690
623.252.1757 (cell)
--
This email sent from Palo Verde Elementary School G Suite for Education.
|
Made the update and confirmed it doesn't balk when trying to create the service. Thanks, @jdstanberry!! Should have this out shortly =] |
## 2.18.1 * [Issue #87](#87) * Added: Additional scopes during Service creation for `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` to enable pulling of full user profile information. - _Thanks, [@jdstanberry](https://github.com/jdstanberry)!_ * [Issue #111](#111) * Added: `DisableReminder` switch parameter to `New-GSCalendarEvent` and `Update-GSCalendarEvent` to remove Reminder inheritance from the calendar the event is on as well as any Reminder overload definitions. * [Issue #53](#53) * Updated: `Get-GSContactList` and `Remove-GSContact` Token retrieval and overall cleanup * Various/Other * Updated: `Get-GSToken` to align parameters more with `New-GoogleService`
## 2.18.1 * [Issue #87](#87) * Added: Additional scopes during Service creation for `Get-GSCourseParticipant` and `Get-GSClassroomUserProfile` to enable pulling of full user profile information. - _Thanks, [@jdstanberry](https://github.com/jdstanberry)!_ * [Issue #111](#111) * Added: `DisableReminder` switch parameter to `New-GSCalendarEvent` and `Update-GSCalendarEvent` to remove Reminder inheritance from the calendar the event is on as well as any Reminder overload definitions. * [Issue #53](#53) * Updated: `Get-GSContactList` and `Remove-GSContact` Token retrieval and overall cleanup * Various/Other * Updated: `Get-GSToken` to align parameters more with `New-GoogleService`
Big thanks to @jdstanberry for pointing out the additional scopes! @IronKane2 - v2.18.1 is now available on the PowerShell Gallery! Try it out and see if you're getting that EmailAddress value back now =] |
@scrthq Yes, same error. |
I see a reference to a similar error posted in this issue previously so posting again here to keep it all together. I have reverted to v2.17.2 for the moment while the other error I posted above is being resolved. So the below is using v2.17.2. I believe everything is configured correctly on my end:
Any thoughts why I can add teachers but not remove them? |
@Foggy2 - Can you update your scopes for your Service Account in the Admin Console @ API Client Access? The Classroom API functions are pretty new, so there's a chance that you may not included the newer Classroom scopes when you set it up. Here's the link to the Initial Setup page with instructions on accessing that page in the Admin Console: https://github.com/scrthq/PSGSuite/wiki/Initial-Setup#adding-api-client-access-in-admin-console And here's the list of scopes that you'll need to copy/paste:
|
I saw the first part of your message but should mention that I just updated the wiki to include the additional profile scopes Sent with GitHawk |
@scrthq - Just double checked the scopes. I had all but the profiles scopes which I have now added. Still getting the error though. |
@scrthq - Figured it out. The error was something on my part although it wasn't immediate clear what I was doing was not allowed. The user I was attempting to remove from the class was set as the class owner. As soon as I changed the owner of the class to the other teacher assigned to the class, the It would have been more useful if Google would provide a better error message other than 'The caller does not have permission' as this implies a scoping issue as you suggested. This is illustrated in the below screen capture. Would it be possible to test for this error condition upon receiving an error response from the API to help point other users towards the real cause? The Google API documentation did not mention this requirement at all. (At least in the pages I read trying to solve this) So I think other users would find it helpful if the real cause was indicated. |
@Foggy2 -Thanks for digging in on that one and figuring it out! We should be able to test for that specific message, but I'd need to see if there are any other errors which could throw the same message. At the very least, the docs/comment based help can be updated to advise that removal of a course owner will return that error. Considering you checked your scopes and re-pasted them recently, can you try out |
@scrthq - Just tested using v2.19.0. I can also confirm that the EmailAddress is populated in the returned results for both commands. |
@Foggy2 - Fantastic, thank you for checking! Paging @IronKane2 to check when able as well =]. Follow up thanks to @jdstanberry for the pointer also. |
Hey guys - going to close this out, as I feel like the Classroom functions are pretty stable now with no other outstanding issues to note. Feel free to open a new issue if anything new pops up! |
Hey all, I'm back. I was experiencing that error, but after getting caught up, I updated my scopes and it works great! Thank you so much for getting those email addresses in the Get-GSCourseParticipant. Sorry my posting is re-opening this, but I really wanted to express my appreciation for all your hard work. I love PSGSuite! You've made my life much easier. |
Cheers, @IronKane2! ❤️ |
Current bugs with Google Classroom specific functions and their status:
New-GoogleService : Cannot find an overload for "ClassroomService" and the argument count: "1"
Get-GSCourse : Exception calling "Execute" with "0" argument(s): "Object reference not set to an instance of an object."
Add-Member : Cannot add a member with the name "CourseId" because a member with that name already exists. To overwrite the member anyway, add the Force parameter to your command.
Get-GSCourseParticipant
&Get-GSClassroomUserProfile
do not return theEmailAddress
property in the profile object. WIPThe text was updated successfully, but these errors were encountered: