Update-Listbox Not Returning Values for PowerBI

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
AzureDataWonk
Posts: 1
Last visit: Sun Mar 05, 2023 10:48 pm

Update-Listbox Not Returning Values for PowerBI

Post by AzureDataWonk »

Hi there,

I am new to PowerShell Studio 2023. I am trying to populate a List Box with a list of Power BI datasets. The command I am using is:
  1. Update-ListBox -ListBox $listBox1 -Items (Get-PowerBIDataset -WorkspaceId "<GUID HERE REDACTED FOR PRIVACY>" | Select Name) -DisplayMember "Name"
This should output a list of all the datasets. When I go to run, the app crashes. I cannot figure out what I am doing wrong. If I hard code the values per the documentation, there is no problem, but as I change the datasets frequently, that is not practical.

To confirm, as part of startup it does log in to PowerBI and also checks that the PowerBI management modules have been loaded.

Open to suggestions here! TIA
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Update-Listbox Not Returning Values for PowerBI

Post by jvierra »

The command does not return a dataset. The command r3eturns an array of objects. Return the results at the commandline and inspect the returned object array. Drop the "Select Name" part first.
This topic is 1 year and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked