Hi all,
I am using ReportServer Enterprise Edition 4.7. I would like to know how to set the default Teamspace for all users.
Thank you
Hi all,
I am using ReportServer Enterprise Edition 4.7. I would like to know how to set the default Teamspace for all users.
Thank you
Hi dkwfung,
you can use scripting for this. Pls check the Script Guide https://reportserver.net/de/dokumentation/scripting-guide-4-7 and the scripting tutorial:
https://reportserver.net/de/dokumentation/tutorials/articles/getting-started-with-scripting
Attached is an example of the demo data installer, written in Groovy, which also automatically creates and assigns dashboards using the createDashboard() function. You can apply a similar approach in your script.
private void createDashboard() {
def db = new Dashboard()
db.name = 'Demo Dashboard'
db.singlePage = true
/* Report */
def rptDgt = new ReportDadget()
rptDgt.config = 'preview'
rptDgt.col = 0
rptDgt.height = 125
rptDgt.container = DadgetContainer.NORTH
rptDgt.report = GLOBALS.getEntitiesByType(Report).find { report ->
report.name == 'Top Employees - Dashboard' }
db.addDadget rptDgt
/* Number of employees */
def cusDadget = new ReportDadget()
cusDadget.col = 0
cusDadget.height = 150
cusDadget.config = 'preview'
cusDadget.report = GLOBALS.getEntitiesByType(Report).find { report -> report.name == 'CustomerCreditLine' }
db.addDadget cusDadget
/* Graph */
def graphDgt = new ReportDadget()
graphDgt.height = 150
graphDgt.config = 'pie'
graphDgt.report = GLOBALS.getEntitiesByType(Report).find { report -> report.key == 'STORE_SALES' }
db.addDadget graphDgt
/* Add dashboard to library */
def dbn = new DashboardNode()
dbn.name = 'Demo Dashboard'
dbn.dashboard = db
dashboardManagerService.roots[0].addChild dbn
dashboardManagerService.persist dbn
/* set newly created dashboard for all users */
userManagerService.getAllUsers().forEach{ u ->
def dbc = dashboardService.getDashboardFor(u)
def dbr = new DashboardReference()
dbr.dashboardNode = dbn
dbr.name = dbn.name
dbc.dashboards.clear()
dbc.dashboards.add(0, dbr)
dashboardService.merge dbc
}
}
Regards,
Eduardo
Hi Eduardo,
Thanks for your reply.
Would you please provide example to assign default teamspace to all users?
Thank you
Regards,
David
Hi dkwfung,
you can get and set a default teamspace with userPropertiesService.
userManagerService.getAllUsers().forEach{ u ->
UserProperty property = userPropertiesService.getProperty(u, "teamspace:primaryTeamSpace");
if (null == property) {
property = new UserProperty("teamspace:primaryTeamSpace", String.valueOf(teamSpace.getId()));
userPropertiesService.setProperty(u, property);
} else {
property.setValue(teamSpace.getId());
}
userManagerService.merge(u);
}
Regards,
Alex