在MS文章的基础上,我创建了一个Powershell来存档团队。当我们不添加请求正文时,该API效果很好,如果添加请求正文,则API也会失败。你能帮我这个忙吗?
PowerShell:
Connect-PnPOnline -AppId "" -AppSecret '' -AADDomain ''
$accessToken = Get-PnPAccessToken
$body = @{ "shouldSetSpoSiteReadOnlyForMembers"= $true } | ConvertTo-Json
$restp = Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken"} -Method POST -Uri 'https://graph.microsoft.com/v1.0/teams/{id}/archive' -ContentType 'application/json' -Body $body
返回:
Error: 400 bad request