Update ssrs_migration.rss with more robust features

Added function to create folder if target does not contain folder.
Added helper function to use relative path for linking data source which is helpful in scenarios where data source does not live in the same directory as report file.
This commit is contained in:
Alex Talarico
2023-05-23 21:36:52 -04:00
committed by GitHub
parent 9dc07a7ab7
commit be61beee04
@@ -223,7 +223,16 @@ Sub Main()
Console.ReadLine()
' Create destination folder if not present
Try
RsSnk.CreateFolder(SnkFolder.Substring(1), "/", Nothing)
Catch ex As Exception
If (ex.Message.Contains("Microsoft.ReportingServices.Diagnostics.Utilities.ItemAlreadyExistsException"))
Console.WriteLine("Folder already exists.")
Else
Console.WriteLine(ex.Message + Environment.NewLine)
End If
End Try
Try
'Roles & Policies
@@ -604,7 +613,7 @@ Sub RelinkItemReferences(snkItem As CatalogItem, srcItem As CatalogItem)
Dim type As String = RsSrc.GetItemType(srcRef.Reference)
Dim snkRef As ItemReference = New ItemReference
snkRef.Name = srcRef.Name
snkRef.Reference = GetSnkFilename(GetSnkPath(srcRef.Reference), type)
snkRef.Reference = GetSnkFilename(GetSnkPathRef(srcRef.Reference), type)
snkReferences.Add(snkRef)
Next
@@ -923,6 +932,12 @@ End Sub
'''''''''''''' Helper Functions '''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Helper function to link snk reference with relative paths
Function GetSnkPathRef(srcPath As String) As String
Dim snkPath = srcPath.Remove(0, srcSiteUrl.LastIndexOf("/"))
Return snkPath
End Function
'Helper function to construct correctly formatted path
Function GetSnkPath(srcPath As String) As String
If Not SrcIsNative Then