#1 2024-09-12 02:54:27

dkwfung
Member
Registered: 2024-04-25

Configure default Teamspace for all user

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

Offline

#2 2024-09-12 11:23:09

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Configure default Teamspace for all user

Hi dkwfung,

you can use scripting for this. Pls check the Script Guide https://reportserver.net/de/dokumentati … -guide-4-7 and the scripting tutorial:
https://reportserver.net/de/dokumentati … -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

Offline

#3 2024-09-16 02:39:10

dkwfung
Member
Registered: 2024-04-25

Re: Configure default Teamspace for all user

Hi Eduardo,

Thanks for your reply.

Would you please provide example to assign default teamspace to all users?

Thank you

Regards,

David

Offline

#4 2024-09-16 12:01:52

alex_lust
Moderator
Registered: 2020-07-03
Website

Re: Configure default Teamspace for all user

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

Offline

Board footer

Powered by FluxBB