jqを使うと文字化けする
1 2 3 4 |
PS C:\Users\yuta> $subjectlist = (Invoke-WebRequest -Uri "https://graph.microsoft.com/v1.0/users/$SmtpAddress/calendar/events?`$filter=Subject eq '$item'" -Headers @{Authorization = "Bearer " + $Token } -ContentType " application/json" -Method Get).content | jq '.value[].subject ' PS C:\Users\yuta> $subjectlist "螂・譚代&繧・ "螂・譚代&繧・ |
ConvertFrom-Json経由でプロパティを取り出すときれいに取得できる
1 2 3 4 5 |
PS C:\Users\yuta> $subjectlist = ((Invoke-WebRequest -Uri "https://graph.microsoft.com/v1.0/users/$SmtpAddress/calendar/events?`$filter=Subject eq '$item'" -Headers @{Authorization = "Bearer " + $Token } -ContentType " application/json" -Method Get).content | ConvertFrom-Json).value.subject PS C:\Users\yuta> $subjectlist 奥村さん 奥村さん PS C:\Users\yuta> |