Repository navigation
Fullname and email #278
Description
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
shinchris commentedon Apr 5, 2018
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.
mehuldan commentedon Nov 20, 2018
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.
Tiji commentedon Feb 26, 2019
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.
Tiji commentedon Feb 26, 2019
It seems that a lot of fields aren't returned by the Rest API by default.
In fact, I can only see :
Thanks.
rollend commentedon May 30, 2019
Hi,
I also have the same problem, any enhancement updated?
Regards,
Shen
lastmeta commentedon Oct 25, 2019
I had the same problem. It's ok if this feature isn't programmed yet, but the documentation should match current production. Please remove
.emailand.fullnamefrom theusers.updateexample:https://tableau.github.io/server-client-python/docs/api-ref#users
KulykDmytro commentedon Nov 22, 2019
server.users.get_by_id() returns
fullnamebut notemailrlmagidson commentedon Aug 21, 2020
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!
Naiana-Tableau commentedon Oct 16, 2020
+1 for being able to return email address
bcantoni commentedon Dec 17, 2020
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.shinchris commentedon Dec 18, 2020
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.capnwes commentedon Mar 10, 2021
In Tableau Server 2019.4 it still seems to return none.
bcantoni commentedon Mar 10, 2021
@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.
capnwes commentedon Mar 10, 2021
@bcantoni We are running Tableau Server Version: 2019.4.3 (20194.20.0128.2054) 64-bit Windows.
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.
bcantoni commentedon Mar 10, 2021
@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.
capnwes commentedon Mar 10, 2021
Oh, whoops! Thanks for clearing that up for me @bcantoni .
RyanSnodgrass commentedon Jun 7, 2021
#565
Upgrading to v.15 confirmed works! Thanks guys!
bcantoni commentedon Jun 7, 2021
I'll go ahead and close this one based on the recent confirmations.