FunctionsPublic/Remove-GraphPage.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
<#
.SYNOPSIS Removes the specified SharePoint Page .DESCRIPTION Removes the specified page from the specified SharePoint site .PARAMETER accessToken A Microsoft Graph API access token with the required permissions .PARAMETER sharePointSiteID The SharePoint site that should be deleted .PARAMETER sharePointPageID The SharePoint page that should be deleted #> function Remove-GraphPage { param( [parameter(Mandatory=$true)][psobject]$accessToken, [parameter(Mandatory=$true)][string]$sharePointSiteID, [parameter(Mandatory=$true)][string]$sharePointPageID ) $responseBody = Invoke-RestMethod ` -Uri "https://graph.microsoft.com/beta/sites/$($sharePointSiteID)/pages/$($sharePointPageID)" ` -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} ` -ContentType "application/json" ` -Method DELETE if($null -eq $responseBody) { return $null } else { return $responseBody.value } } |