From 6ddd9ac8ac79ddf892b5a9d85924aa995cb5e1e5 Mon Sep 17 00:00:00 2001 From: levik-opsilient Date: Tue, 2 Jul 2024 18:07:50 -0400 Subject: [PATCH 1/2] add option to use parent path as item properties When downloading using Export-FabricItems the path becomes [displayName].[itemType] this option makes it simple to re- import an entire workspace --- pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 b/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 index b5b5426b..4cc72c53 100644 --- a/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 +++ b/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 @@ -586,6 +586,8 @@ Function Import-FabricItems { [hashtable]$fileOverrides , [hashtable]$itemProperties + , + [switch]$useDirNameAsProperties ) # Search for folders with .pbir and .pbism in it @@ -683,7 +685,14 @@ Function Import-FabricItems { $displayName = $foundItemProperty.displayName } } - + + # Use the parent path to set the displayName and itemType, if useDirNameAsProperties parameter was set + + if ($useDirNameAsProperties) { + $displayName = $itemName.Split('.')[0] + $itemType = $itemName.Split('.')[1] + } + # Try to read the item properties from the .platform file if not found in itemProperties if ((!$itemType -or !$displayName) -and (Test-Path -LiteralPath "$itemPath\.platform")) From a7ea052f235c0f571f053883c0d1e6e1018db5ac Mon Sep 17 00:00:00 2001 From: levik-opsilient Date: Wed, 3 Jul 2024 20:21:45 -0400 Subject: [PATCH 2/2] prevent conflict with .platform or itemProperties --- pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 b/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 index 4cc72c53..4bec621e 100644 --- a/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 +++ b/pbidevmode/fabricps-pbip/FabricPS-PBIP.psm1 @@ -689,8 +689,11 @@ Function Import-FabricItems { # Use the parent path to set the displayName and itemType, if useDirNameAsProperties parameter was set if ($useDirNameAsProperties) { - $displayName = $itemName.Split('.')[0] - $itemType = $itemName.Split('.')[1] + if ($itemProperties -or (Test-Path -LiteralPath "$itemPath\.platform")){ + Write-Host "itemProperties have been passed in or .platform file exists `n Will not set itemProperties based on path"} + else { + $displayName = $itemName.Split('.')[0] + $itemType = $itemName.Split('.')[1]} } # Try to read the item properties from the .platform file if not found in itemProperties