首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >从Reporting Services迁移到SSDT

从Reporting Services迁移到SSDT
EN

Stack Overflow用户
提问于 2018-12-04 23:52:13
回答 1查看 41关注 0票数 0

我们正在将SSRS报告从Reportings Services移动到SSDT 2017。有成千上万的文件夹。如何在不手动创建文件夹结构的情况下将这些文件夹和.rdl文件导入SSDT?

EN

回答 1

Stack Overflow用户

发布于 2018-12-05 04:31:58

使用powershell的黑客攻击,基于来自https://github.com/Microsoft/Reporting-Services/blob/master/APISamples/powershell/powershellSamples.ps1的示例

代码语言:javascript
复制
Import-Module SqlServer

$targetReportDirectory = "c:\temp\rs" #where to put the files

If (-Not (Test-Path $targetReportDirectory)) {new-Item -Path $targetReportDirectory -ItemType directory -Force}

#recreate directory structure on disk
Invoke-Sqlcmd -ServerInstance localhost -Database ReportServer -Query "Select Path from [Catalog] Where Type = 1 and Nullif(Path, '') is not null --Folders" | ForEach {
    $localpath = Join-Path $targetReportDirectory $_.Path 

    If (-Not (Test-Path $localpath)) {$f = new-Item -Path $localpath -ItemType directory -Force}

}


#pull all reports down
$ReportPortalUri = "http://localhost/Reports"
Invoke-Sqlcmd -ServerInstance localhost -Database ReportServer -Query "Select ItemID, Path from [Catalog] Where Type = 2 and Nullif(Path, '') is not null --Reports" | ForEach {

    $catalogItemsApi = $ReportPortalUri + "/api/v1.0/catalogitems($($_.ItemID))/Content/`$value"
    $response = Invoke-WebRequest -Uri $catalogItemsApi -Method Get -UseDefaultCredentials
    $downloadPath = Join-Path $targetReportDirectory $($_.Path + ".rdl")
    [System.IO.File]::WriteAllBytes($downloadPath, $response.Content)

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53616727

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档