Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sends an HTTP or HTTPS request to a SharePoint Online REST-compliant web service.
This function sends an HTTP or HTTPS request to a Representational State
Transfer (REST)-compliant ("RESTful") SharePoint Online web service.
Invoke-SPORestMethod -Uri "" -AccessToken $accessToken
Function Invoke-SPORestMethod()
[Microsoft.PowerShell.Commands.WebRequestMethod]$Method = [Microsoft.PowerShell.Commands.WebRequestMethod]::Get,
$contentType = 'application/json;odata=verbose'
if(-not $Headers) {
$Headers = @{}
$Headers["Accept"] = "application/json;odata=verbose"
$Headers.Add('Authorization','Bearer ' + $AccessToken)
Invoke-RestMethod -Method $Method -Uri $Uri -ContentType $contentType -Headers $Headers -Body $Body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment