server-client-python: Unable to fetch all workbooks for users.populate_workbooks(user)

Unable to fetch all workbooks for a given user.

Versions Details of your environment, including:

  • Tableau Online
  • Python 3.7+
  • tableauserverclient<=0.14.1

To Reproduce ` import tableauserverclient as tsc from tableauserverclient.server.endpoint.exceptions import ServerResponseError

    def get_workbooks_users(self) -> list: #tableau credentials are passed through Self

    list_workbooks_n_users = []
    try:
        with self.server.auth.sign_in(self.tableau_auth):
            for user in tsc.Pager(self.server.users):
                if 'tol.admin.api.broker.service.usera@tableau.com' not in user.name:
                    self.server.users.populate_workbooks(user)
                    for wkb in user.workbooks:
                        print(wkb.name, user.name)
                        list_workbooks_n_users.append({
                            'user_id': user.id,
                            'user_name': user.name,
                            'wb_id': wkb.id,
                            'wb_name': wkb.name,
                            'project_id': wkb.project_id,
                            'project_name': wkb.project_name,
                            "site_id": self.site_id
                        })
    except ValueError:
        print("some thing")
    finally:
        print("some other thing")
    return list_workbooks_n_users

`

Results I only get the first one hundred results for my user. I know the user has access to all tableau assets.

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@kdutta-c FYI, populating workbooks on a user will tell you all workbooks that that user owns, not all workbooks that they have access to. For owners, you can also use the metadata API, with a query like this:

query wbowners {
  workbooks{
    owner{
      luid
      username
    }
    luid
    name
    projectName
    site{
      luid
      name
    }
  }
}

Getting all content that a user has access to is a much more complicated affair, requiring checking the permissions of every item on the server. the group membership of each user, and so on… OR taking the equally complicated route of signing in to the site as each user and trying to query all workbooks on the server.

Any update on this?