FunctionsPublic/Get-GraphSharepointHomePage.ps1
<#
.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 } } |