Skip to content

Fullname and email #278

Closed
Closed

Description

@Programattica

Hello,

I have a python script utilizing the Tableau Server Client (TSC). I am trying to pull down information about the users. Below is the code, slightly modified from the example given online from the Tableau Github page (https://tableau.github.io/server-client-python/docs/api-ref#requests).

Just to be clear...I am using a server administrator account to pull the data.

Using the link above as a reference, scroll down to “Users”. Just below will show the attributes available in the UserItem class. You will see 'name', site_role','fullname' and 'email' are included in that list.
When I try to query the API for 'fullname' and 'email' I get “None”. According to documentation Tableau populates the email address and display name with info from AD during import. When I log into Tableau, the two fields are populated as expected. But as stated, when I do a pull using TSC, it pulls back nothing. I don’t think it’s my code as I am not getting errors. And I am using two other attributes (name and site_role) that both pull back the correct information when queried. See below for the code I am using.

---Works---
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
UsersDB = [(user.name,user.site_role) for user in all_users]

What I want to do is include 'user.fullname' and 'user.email' in the above query. But when I do I get "None" as my results for those two attributes only, 'user.name' and 'user.site_role' both pull back data.

---Does not work correctly----
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
UsersDB = [(user.fullname,user.name,user.site_role,user.email) for user in all_users]

SIDE NOTE: I have been reviewing the user_item.py file to see if something was overlooked. I am NOT an expert with classes so I am not really sure what am looking at. However I don't think properties were declared for email and full name. I tried added them and get errors saying things like "inconsistent use of tabs and spaces in indentation". When I replace and existing property to avoid this error I get an error saying "can't set attribute". So I obviously don't understand this file. I need this information for a work project.

Here is the file I was reviewing....
https://github.com/tableau/server-client-python/blob/master/tableauserverclient/models/user_item.py
I was messing with "def init" and the '@properties' below it.

Please advise.

EDIT:
SIDE NOTE clear up - I figured out the tabs and spacing issue. Apparently it didn't like it when I tabbed for indentation. So I put 4 spaces every for my issues and it solved that issue.

Once I cleared up that, I get an error like "fullname must not be empty".

Activity

  1. shinchris commented on Apr 5, 2018

    @shinchris
    Contributor

    Seems like the problem is that user.fullname and user.email are the two fields that are not returned by our Rest API by default. Using the Rest API, you could get those two fields by using the 'fields' parameter to expand your query (https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api_concepts_fields.htm%3FTocPath%3DConcepts%7C_____8)

    Currently, however, TSC does not support using the 'fields' parameter, so there is no way to get user.fullname and user.email. I'll add this to our backlog.

  2. mehuldan commented on Nov 20, 2018

    @mehuldan

    req_option = tsc.RequestOptions()
    req_option.filter.add(tsc.Filter(tsc.RequestOptions.Field.Name,
    tsc.RequestOptions.Operator.Equals,
    'xyz'))
    newuid= server.users.get(req_option)
    print('newuid',newuid)
    newid = newuid[0][0].id
    newname = newuid[0][0].name
    fullnewname = newuid[0][0].fullname
    print('newname',newname,fullnewname)

    Output:
    newname xyz None

    Please could you update us when the fullname attribute is fixed to display full name. so for ID xyz, I except to see Zen XY.

  3. Tiji commented on Feb 26, 2019

    @Tiji

    Hello,
    Any news about this enhancement ?
    I've been struggling with user_item.py to find a solution to bring up all the fields from a specific user but without any success for now :(
    Thanks.

  4. Tiji commented on Feb 26, 2019

    @Tiji

    Seems like the problem is that user.fullname and user.email are the two fields that are not returned by our Rest API by default.

    It seems that a lot of fields aren't returned by the Rest API by default.
    In fact, I can only see :

    • name
    • last_login
    • id
    • site_role

    Thanks.

  5. rollend commented on May 30, 2019

    @rollend

    Hi,
    I also have the same problem, any enhancement updated?
    Regards,
    Shen

  6. lastmeta commented on Oct 25, 2019

    @lastmeta

    I had the same problem. It's ok if this feature isn't programmed yet, but the documentation should match current production. Please remove .email and .fullname from the users.update example:

    https://tableau.github.io/server-client-python/docs/api-ref#users

  7. KulykDmytro commented on Nov 22, 2019

    @KulykDmytro
    Contributor

    server.users.get_by_id() returns fullname but not email

  8. rlmagidson commented on Aug 21, 2020

    @rlmagidson

    Hello - has there been any update to returning the email address? We need to retrieve the email address for a specified user and can't move due to this.
    Thank you!

    • rlm
  9. Naiana-Tableau commented on Oct 16, 2020

    @Naiana-Tableau

    +1 for being able to return email address

  10. bcantoni commented on Dec 17, 2020

    @bcantoni
    Contributor

    For users.get(), it should be returning full name and email address now with the changes from #713 (this was included in release 0.14.0).

    As for users.get_by_id(), I think email is being returned there but I'm not sure if it's just recent Tableau Server versions or not.

  11. shinchris commented on Dec 18, 2020

    @shinchris
    Contributor

    For users.get_by_id(), email should now be returned if you are using Tableau Online or the latest Tableau Server releases (December) from 2019.3 through 2020.3. 2020.4 was just released, but won't have the fix until 2020.4.1.

  12. capnwes commented on Mar 10, 2021

    @capnwes

    For users.get_by_id(), email should now be returned if you are using Tableau Online or the latest Tableau Server releases (December) from 2019.3 through 2020.3. 2020.4 was just released, but won't have the fix until 2020.4.1.

    In Tableau Server 2019.4 it still seems to return none.

  13. bcantoni commented on Mar 10, 2021

    @bcantoni
    Contributor

    @capnwes could you confirm which specific version of 2019.4 you are using? The latest maintenance release there is 2019.4.17 and that should have the server-side part of this fix Chris mentioned.

  14. capnwes commented on Mar 10, 2021

    @capnwes

    @capnwes could you confirm which specific version of 2019.4 you are using? The latest maintenance release there is 2019.4.17 and that should have the server-side part of this fix Chris mentioned.

    @bcantoni We are running Tableau Server Version: 2019.4.3 (20194.20.0128.2054) 64-bit Windows.

      user1 = server.users.get_by_id('9f9e9d9c-8b8a-8f8e-7d7c-7b7a6f6d6e6d')
      print(user1.name)
      print(user1.email)
    

    I used this (but with an ID from my server) as a test case.
    The name was returned but the e-mail still returned "None".
    Also confirmed there was indeed a name on the server for that user.

    edit:
    I will add that we use Active Directory for our users, but I do not think that would cause an issue pulling the e-mail.

  15. bcantoni commented on Mar 10, 2021

    @bcantoni
    Contributor

    @capnwes ahh okay, thanks for confirming. The fix here requires both using the latest TSC library and being on the latest maintenance releases for Tableau Server. So for your case that would be 2019.4.17. When your server is upgraded to that version then this should work for you.

  16. capnwes commented on Mar 10, 2021

    @capnwes

    @capnwes ahh okay, thanks for confirming. The fix here requires both using the latest TSC library and being on the latest maintenance releases for Tableau Server. So for your case that would be 2019.4.17. When your server is upgraded to that version then this should work for you.

    Oh, whoops! Thanks for clearing that up for me @bcantoni .

  17. RyanSnodgrass commented on Jun 7, 2021

    @RyanSnodgrass

    #565
    Upgrading to v.15 confirmed works! Thanks guys!

    • Tableau Server Version: 2020.4.2 (20204.21.0217.1203) 64-bit Windows
    • tableauserverclient v0.15
    import tableauserverclient as TSC
    tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')
    server = TSC.Server('https://SERVERURL')
    
    with server.auth.sign_in(tableau_auth):
        all_users, pagination_item = server.users.get()
        for user_item in all_users:
                print("User name: '{}' fullname: '{}', User email: '{}'".format(user_item.name,
                                                                          user_item.fullname,
                                                                          user_item.email))
    
    # =>
    # User name: 'username123' fullname: 'User Name123', User email: 'uname@nd.edu'
  18. bcantoni commented on Jun 7, 2021

    @bcantoni
    Contributor

    I'll go ahead and close this one based on the recent confirmations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions