Skip to content

Get-MgmtGraphGroupOnenoteNotebookFromWebUrl

MgmtGraph: Retrieves group OneNote notebook from a web URL

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Groups

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$GroupId,

    [Parameter(Mandatory = $true, Position = 1)]
    [string]$WebUrl
)

Process {
    try {
        $notebook = Get-MgGroupOnenoteNotebookFromWebUrl -GroupId $GroupId -WebUrl $WebUrl -ErrorAction Stop
        
        $result = [PSCustomObject]@{
            GroupId       = $GroupId
            NotebookId    = $notebook.Id
            DisplayName   = $notebook.DisplayName
            WebUrl        = $notebook.Self ?? $WebUrl
            Timestamp     = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

The unique identifier of the Microsoft Graph group.

The web URL of the OneNote notebook to retrieve.

An interactive directory of PowerShell scripts.