GroupItem Class is not passing Group ID back
The following is a portion of the code i am attempting to make and it's purpose is to obtain a list of userIDs and iterate through them to assign to an specified group.
a = ['fake-id-12345678','other-fake-user-id12345']
with server.auth.sign_in(tableau_auth):
group_user = 'All Users'
targetgroup = TSC.GroupItem(group_user)
for userids in a:
server.groups.add_user(targetgroup,userids)
/usr/local/lib/python2.7/site-packages/tableauserverclient/server/endpoint/groups_endpoint.pyc in _add_user(self, group_item, user_id) 95 if not group_item.id: 96 error = "Group item missing ID." ---> 97 raise MissingRequiredFieldError(error) 98 if not user_id: 99 error = "User ID undefined."
MissingRequiredFieldError: Group item missing ID.
Now the interesting thing is, when i do a check using the .get() function, it returns a list of them: all_groups, pagination_item = server.groups.get() for group in all_groups: if group.name == group_user : print(group.name, group.id)
Maybe im missing something?
@chrissalter sorry for the delay in response, I didn't see this issue was opened based in Sept. I think the issue is that you need to make sure that the group is created on the server first. You can't just create a GroupItem within TSC, you'll need to either call server.groups.create(targetgroup) or if it's already created, you need to call server.groups.get() to find the appropriate group item.
Does that make sense? GroupItem only has an Id once it's talked to the server via the endpoint. Just creating a GroupItem via the Item object doesn't talk to the server, it just creates the object in memory.
Not a problem for the response time as i'm a culprit as well. Thanks for the assistance, this can be closed.