Closed
Description
I have come across a problem where if I trigger Invoke-GraphRequest from a WPF button the command freezes.
This seems to affect at least getting a list of onenote section groups or sections or pages
I have tried debugging in VSCode setting a breakpoint on the line that runs Invoke-GraphRequest and it also does the same thing.
Below created an example using minimal code.
I have also included Get-MgGroupOnenoteNotebookSectionGroup which works fine and returns the correct result.
Please enter the top 3 variables for testing (removed as they were specific to my tenant)
#a group id from graph which could be retrieve using Get-MgGroup
$groupid = ""
#a notebook id from graph which could be retrieve using Get-MgGroupOnenoteNotebook
$notebookid = ""
#a section group uri from (Get-MgGroupOnenoteNotebook -groupid $groupid -notebookid $notebookid).sectionGroupsUrl
$sectiongroupsuri = ""
#Make sure we are authenticated to graph
Connect-Graph -scope @("Notes.ReadWrite.All","Group.Read.All","Sites.Read.All") | out-null
#build ui
Add-Type -AssemblyName PresentationFramework
[xml]$xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Window" Height="200" Width="300">
<Grid Background="#FFECECEC">
<Button Name="button1" Content="Get-MgGroupOnenoteNotebookSectionGroup" HorizontalAlignment="Left" Margin="10,10,10,10" VerticalAlignment="Top"/>
<Button Name="button2" Content="Invoke-GraphRequest" HorizontalAlignment="Left" Margin="10,50,10,10" VerticalAlignment="Top"/>
</Grid>
</Window>
"@
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
$window = [Windows.Markup.XamlReader]::Load($reader)
$button1 = $window.FindName("button1")
$button1.Add_Click( {
write-host (Get-MgGroupOnenoteNotebookSectionGroup -GroupId $groupid -NotebookId $notebookid | out-string)
})
$button2 = $window.FindName("button2")
$button2.Add_Click( {
write-host (Invoke-GraphRequest -uri $sectiongroupsuri | out-string)
})
$window.ShowDialog()
Metadata
Metadata
Assignees
Labels
No labels