Any PnP function is not working (hangs) after New-Object System.Windows.Forms.Form #3218
Unanswered
santal-fuego
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Discussed in #3210
Originally posted by santal-fuego June 21, 2023
Hi all.
I'm trying to create some GUI for users which helps them to create channel under some predefined template.
Everything works fine, until I create the GUI form and elements with New-Object. After that functions like:
Get-PnPList
Get-PnPTeamsChannelFilesFolder
just hangs. The lines of code after them never been reached.
I tried to move all the PnP calls before creating GUI, but for sure I need to do some calls (Create, Copy etc.) after processing user input on the form.
I tried to use 2.1.56 and 2.1.84 without success (as well as 2.1.1).
I also tried to destroy an object in some way, but this also not helped.
I not understand what is happening, and how to make it working.
I cut down the code which still hangs (variables should be defined:
`
import-module -FullyQualifiedName @{ModuleName = 'PnP.Powershell'; ModuleVersion = '2.1.84' } -Force
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$conn = Connect-PnPOnline $newTeamSPO -Credentials $credential
$frmMain = New-Object System.Windows.Forms.Form
$templateLists = Get-PnPList -Connection $conn
`
As soon as $frmMain line is uncommented, the $templateLists is not working. After commenting all is working just fine.
Any advices?
Beta Was this translation helpful? Give feedback.
All reactions