Forum Discussion
AwaisKhalid
Aug 18, 2020Copper Contributor
Create meeting Using PowerShell, Graph API and CSV File
I have successfully created the teams meeting using Graph API and PowerShell. Now i wan to import a csv and want to create meeting using that csv file. There are two columns in csv DisplayName and UP...
- Aug 18, 2020
Try to use this body:
$bodyy = @" { "subject": "Let's go for lunch", "body": { "contentType": "HTML", "content": "Does noon work for you?" }, "start": { "dateTime": $($_.StartTime), "timeZone": "Pakistan Standard Time" }, "end": { "dateTime": $($_.EndTime), "timeZone": "Pakistan Standard Time" }, "location":{ "displayName":$($_.DisplayName) }, "attendees": [ { "emailAddress": { "address":$($_.UPN), #Want to use csv data here "name": "Awais Khalid" }, "type": "required" } ], "allowNewTimeProposals": true, "isOnlineMeeting": true, "onlineMeetingProvider": "teamsForBusiness" } "@
Manfred de Laat
Manfred101
Aug 18, 2020Iron Contributor
Try to use this body:
$bodyy = @"
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": $($_.StartTime),
"timeZone": "Pakistan Standard Time"
},
"end": {
"dateTime": $($_.EndTime),
"timeZone": "Pakistan Standard Time"
},
"location":{
"displayName":$($_.DisplayName)
},
"attendees": [
{
"emailAddress": {
"address":$($_.UPN), #Want to use csv data here
"name": "Awais Khalid"
},
"type": "required"
}
],
"allowNewTimeProposals": true,
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
}
"@
Manfred de Laat
- AwaisKhalidAug 18, 2020Copper Contributor
Thank You so much, That worked.
Kind Regards
Manfred101- Johnny-5Jun 23, 2021Copper ContributorHey guys, I'm trying to mimic the $bodyy variable here to create an all-day appointment but I'm getting " Invoke-RestMethod : The remote server returned an error: (400) Bad Request".
Any help is much appreciated.
Thank you,
Johnny
Code:
$eventBody = @"
{
"originalStartTimeZone": "UTC",
"originalEndTimeZone": "UTC",
"subject": "Lets go for lunch",
"body": {
contentType: "HTML",
content: "Does noon work for you?"
},
"start": {
dateTime: "2021-06-22T12:00:00",
timeZone: "UTC"
},
"end": {
dateTime: "2021-06-23T12:00:00",
timeZone: "UTC"
},
"showAs": "oof",
"isAllDay": true,
"isReminderOn": false,
"type": "singleInstance"
}
"@
$newAppt = Invoke-RestMethod -Headers @{Authorization = "Bearer $($Tokenresponse.access_token)"} -Uri $apiUrl -Method POST -Body $eventBody -ContentType "application/json"