0

我的报告服务器上有大量报告。他们中的大多数都有一个使用共享计划的缓存刷新计划。是否可以通过编程方式在报表上设置缓存刷新计划?启用缓存,使用共享计划为缓存设置过期时间,根据共享计划运行快照,所有工作都使用 SetExecutionOptions-method 和 SetCacheOptions-method 运行良好。

但是,为报告设置缓存刷新计划并不能正常运行。建议?

编辑:我想对所有人都做同样的事情,数据集将它们设置为按共享时间表刷新。

下面是我正在使用的代码(Powershell V3)

$reportServerURI = "http://localhost/Reportserver"
$ReportPathWildCard = "/SOME/FOLDER/ON/SERVER";
$NameSharedSchedule="NAMEOFSCHEDULE";

# init WS proxy
$reportServerURI2010 = "$reportServerURI/ReportService2010.asmx?WSDL"
$RS = New-WebServiceProxy -Uri $reportServerURI2010 -UseDefaultCredential
$proxyNamespace = $RS.GetType().Namespace
#Get Schedule Reference
$NeverExpireSchedule= $RS.ListSchedules([System.Management.Automation.Language.NullString]::Value) | where {$_.Name -eq "$NameSharedSchedule"}
$NeverExpireScheduleID = $NeverExpireSchedule.scheduleid;
$NeverExpireDescription = $NeverExpireSchedule.Description;
$NeverExpireDefinition = $NeverExpireSchedule.Definition;
Write-Host "Found Shared Schedule: '$NameSharedSchedule' with id $NeverExpireScheduleID and definition $NeverExpireDescription";

$NeverExpireScheduleRef =New-Object("$proxyNamespace.ScheduleReference");
$NeverExpireScheduleRef.ScheduleID=$NeverExpireScheduleID;


#get all needed items
$items = $RS.ListChildren($ReportPathWildCard, $true)  | Where-Object {"Report" -contains $_.TypeName} 
#process all items
foreach ($item in $items) {
    $xpath = $item.path
    $xtype = $item.TypeName
    Write-Host "Processing $xtype $xpath"


    ##SET Refresh

   $r= $RS.SetExecutionOptions( $xpath,"Snapshot",$NeverExpireDefinition) 
}
4

1 回答 1

3

真的找到了。不知何故,我和我的几个同事忽略了它: CreateCacheRefreshPlan 方法是解决方案......

它看起来不太好(但是嘿,我不是开发人员),其中一半是无耻的抄袭,但它确实起到了作用.... :)

感谢所有发布我需要的花絮的人......

$reportServerURI = "http://localhost/Reportserver"
$ReportPathWildCard = "/";
$NameSharedSchedule="NAME OF SCHEDULE";

# init WS proxy
$reportServerURI2010 = "$reportServerURI/ReportService2010.asmx?WSDL"
$RS = New-WebServiceProxy -Uri $reportServerURI2010 -UseDefaultCredential
$proxyNamespace = $RS.GetType().Namespace
# Get Schedule Reference
$NeverExpireSchedule= $RS.ListSchedules([System.Management.Automation.Language.NullString]::Value) | where {$_.Name -eq "$NameSharedSchedule"}
$NeverExpireScheduleID = $NeverExpireSchedule.scheduleid;
$NeverExpireDescription = $NeverExpireSchedule.Description;
$NeverExpireDefinition = $NeverExpireSchedule.Definition;
#Write-Host "Found Shared Schedule: '$NameSharedSchedule' with id $NeverExpireScheduleID and definition $NeverExpireDescription";

$NeverExpireScheduleRef =New-Object("$proxyNamespace.ScheduleReference");
$NeverExpireScheduleRef.ScheduleID=$NeverExpireScheduleID;



# Wat dingen voorbereiden
#delivery Extension
   #$setting = "Report Server Email"
   $matchdata = $NeverExpireScheduleID
   $description = "Automatisch ingesteld op " + $NameSharedSchedule
   $eventtype = "RefreshCache"
   $parameters

#get all needed items
$items = $RS.ListChildren($ReportPathWildCard, $true)  | Where-Object {"Dataset" -contains $_.TypeName} 
#process all items
foreach ($item in $items) {
    $xpath = $item.path
    $xtype = $item.TypeName
    Write-Host "Processing $xtype $xpath"

    $report = $xpath


    ##SET Cache
    $r= $RS.SetCacheOptions( $xpath,[System.Management.Automation.Language.NullString]::Value, $o) 

  $r= $RS.CreateCacheRefreshPlan(   $report,
                                    $description,
                                    $eventtype,
                                    $matchdata,
                                    $parameters
                                    )

}
于 2013-09-13T14:35:53.870 回答