FunctionsPublic/Get-GraphSharepointHomePage.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 40 41 42 |
<#
.SYNOPSIS Get home page of specified SharePoint site .DESCRIPTION Uses the SharePoint ID to determine what the current home page of the specified site is .PARAMETER accessToken A Microsoft Graph API access token with the required permissions .PARAMETER sharePointSiteID The SharePoint site to get the home page for #> function Get-GraphSharepointHomePage { [cmdletbinding()] param ( [PSObject]$accessToken, [string]$sharePointSiteID ) process { $responseBody = Invoke-RestMethod ` -Uri "https://graph.microsoft.com/beta/sites/$($sharePointSiteID)/pages?$filter=pageLayout eq 'Home'" ` -Headers @{ "Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)" } if($null -eq $responseBody.id) { $groupsResult = $responseBody.value } else { $groupsResult = $responseBody } $groupsResult } } |