invoke-restmethod
2 TopicsStruggling with my BODY [my BODY is ok! - TY Lain]
$URL = $betaGraphURL+"/users/"+$DATA[5]+"/onlineMeetings" $OLMeetingBODY = @{ "startDateTime" = $finalCLASSstart "endDateTime" = $finalCLASSend "subject" = $classTITLE "broadcastSettings" = @{ "allowedAudience" = "everyone" "isQuestionAndAnswerEnabled" = $true } } $OLMeeting = invoke-restmethod -head $d_HEAD -uri $URL -method post -body ($OLMeetingBODY|convertto-json) Hello community! Line 6 is giving me grief. It works without any 'broadcastSettings' enabled. I know it has to be something quick an simple. But for the life of me, I just cannot seem to get it to work. $DATA[5] = Users Object ID $d_HEAD = Delegation header Any guidance would be ever so appreciated! ~WMSolved1KViews0likes2Commentsinvoke-restmethod multipart content
I have a PowerShell script that calls the Canvas VLE SIS import API to batch enrol students into a course. The script calls invoke-restmethod to post a multipart CSV file with the details of the students to enrol. This is the format of the file: --CanvasData Content-Disposition: form-data; name="attachment"; filename="enrol_S2020-A52172-D0016-1.csv" Content-Type: text/csv; charset=utf-8 "section_id","user_id","role","status" "S2020-A52172-D0016","000000","student","active" "S2020-A52172-D0016","111111","student","active" "S2020-A52172-D0016","222222","student","active" "S2020-A52172-D0016","333333","student","active" "S2020-A52172-D0016","444444","student","active" --CanvasData-- The content is uploaded and processed successfully when running on PowerShell 4.0. However, if I run the same script in PowerShell 5.1, the content is uploaded but the processing fails. I have verified that the CSV content is valid, so the only reason for this failure that I can think of is that PowerShell 5.1 handles multipart content different to 4.0. Any suggestions on how I can change the script / multipart content so that the enrolment upload works on PowerShell 5.1 ?1.7KViews0likes0Comments