8000 Fullname and email · Issue #278 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Fullname and email #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Programattica opened this issue Mar 19, 2018 · 18 comments
Closed

Fullname and email #278

Programattica opened this issue Mar 19, 2018 · 18 comments

Comments

@Programattica
Copy link
Programattica commented Mar 19, 2018

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".

@shinchris
Copy link
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.

@mehuldan
Copy link

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
Copy link
Tiji commented 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
Copy link
Tiji commented Feb 26, 2019

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.

@rollend
Copy link
rollend commented May 30, 2019

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

@lastmeta
Copy link
lastmeta commented 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 .email and .fullname from the users.update example:

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

@KulykDmytro
Copy link
Contributor

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

@rlmagidson
Copy link

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

@Naiana-Tableau
Copy link

+1 for being able to return email address

@bcantoni
Copy link
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.

@shinchris
Copy link
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.

@capnwes
Copy link
capnwes commented Mar 10, 2021

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.

@bcantoni
Copy link
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.

@capnwes
Copy link
capnwes commented 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.

@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.

@bcantoni
Copy link
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.

@capnwes
Copy link
capnwes commented 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.

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

@RyanSnodgrass
Copy link

#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'

@bcantoni
Copy link
Contributor
bcantoni commented Jun 7, 2021

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
La 4CF8 bels
Projects
None yet
Development

No branches or pull requests

0