Aug 18 2020 12:43 AM
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 UPN. Can anyone please help me with this
Import-Csv -Path "C:\Users\Awais\OneDrive - CS\Desktop\GraphAPI.csv" | foreach {
$apiUrl = "https://graph.microsoft.com/v1.0/me/events"
$bodyy = @'
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": $_.StartTime, #Want to use csv data here
"timeZone": "Pakistan Standard Time"
},
"end": {
"dateTime": $_.EndTime, #Want to use csv data here
"timeZone": "Pakistan Standard Time"
},
"location":{
"displayName":$_.DisplayName #Want to use csv data here
},
"attendees": [
{
"emailAddress": {
"address":$_.UPN, #Want to use csv data here
"name": "Awais Khalid"
},
"type": "required"
}
],
"allowNewTimeProposals": true,
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
}
'@
$DataPOST = Invoke-RestMethod -Headers @{Authorization = "Bearer $($Tokenresponse.access_token)"} -Uri $apiUrl -Method POST -Body $bodyy -ContentType 'application/json'}
}
Aug 18 2020 03:40 AM - edited Aug 18 2020 03:44 AM
SolutionTry 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
Aug 18 2020 03:52 AM
Thank You so much, That worked.
Kind Regards
@Manfred101
Jun 22 2021 07:12 PM
Dec 26 2021 04:39 AM
Aug 18 2020 03:40 AM - edited Aug 18 2020 03:44 AM
SolutionTry 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