SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
235 stars 67 forks source link

Cant specify -Id on New-GSCourse #230

Closed Chris4678 closed 5 years ago

Chris4678 commented 5 years ago

Describe the bug New-GSCourse works fine as far as I can tell as long as you don't specify an id using the -Id tag. If you do it will throw an error. I tried using the exact line from "example 1" on the wiki page for the command. I only changed the owner email to be my admin account. I still get this same error: New-GSCourse : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError Request contains an invalid argument. [400] Errors [ Message[Request contains an invalid argument.] Location[ - ] Reason[badRequest] Domain[global] ] " To Reproduce Steps to reproduce the behavior:

  1. Setup PSGSuite
  2. use the -Id tag on the New-GSCourse command

Expected behavior Error stating you are calling execute with 0 arguments

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

scrthq commented 5 years ago

Hey @Chris4678 - when you're setting the Id, are you setting it in the Alias String format? https://developers.google.com/classroom/reference/rest/v1/courses.aliases#CourseAlias

image

scrthq commented 5 years ago

image

Chris4678 commented 5 years ago

OK when I add d: in front of the ID the command runs. However, I cant tell how to then see the alias I just set. When I use get-GSCourseAlias it returns {Google.Apis.Classroom.v1.Data.CourseAlias} How can I see what the actual value of that is?

Also just so you know your wiki page doesn't have anything about needing the d: or p: in the example or description: https://github.com/scrthq/PSGSuite/wiki/New-GSCourse

Chris4678 commented 5 years ago

never mind I have figured it out adding a .alias on the output shows what I need.

Thanks for all your help.

scrthq commented 5 years ago

Was about to respond but you beat me to it! Glad you're sorted, @Chris4678 !