microsoft / powerbi-powershell

PowerShell community for Microsoft PowerBI. Here you will find resources and source for PowerShell modules targeting PowerBI.
MIT License
346 stars 120 forks source link

Get-PowerBIReport -Workspace vs -WorkspaceId parameters #327

Open davesbrown opened 3 years ago

davesbrown commented 3 years ago

What's the difference? I can use -WorkspaceId with the guid no problem, but if I use -Workspace with a named workspace like 'MyWorkspace' then I get an error:

Get-PowerBIReport : Cannot bind parameter 'Workspace'. Cannot convert the "MyWorkspace" value of type "System.String" to type "Microsoft.PowerBI.Common.Api.Workspaces.Workspace".

It obviously doesn't like the datatype as string, do I strongly type it as 'Workspace' ?

TIA

regedit32 commented 3 years ago

The -Workspace parameter accepts an object of type Microsoft.PowerBI.Common.Api.Workspaces.Workspace, which you can retrieve using Get-PowerBIWorkspace. When using the -Workspace parameter, the Get-PowerBIReport cmdlet will use the Id from the Workspace object to filter for the report.