I am struggling with getting all of the creators in a certain group in my Enterprise portal environment.
I am using Enterprise Notebook.
group = gis.groups.get("6bde3136acbb48bcba1edc2eca61eac6")
response = group.get_members()
for user in response['users'] :
print(user)
will list all the users in specified group, but how do I limit it further to only Creators?
Solved! Go to Solution.
Hey Jeff Timm,
So I just checked the API and the group.get_memebers() returns an array of usernames and not user objects like I thought it would. I think if you change it to something like this you will have some better luck:
group = gis.groups.get("6bde3136acbb48bcba1edc2eca61eac6")
response = group.get_members()
for username in response['users'] :user = gis.users.get(username)
if(user.userLicenseTypeId == "creatorUT"):print(user)
Hey Jeff Timm,
You can print out the creators using something like so:
group = gis.groups.get("6bde3136acbb48bcba1edc2eca61eac6")
response = group.get_members()
for user in response['users'] :
if(user.userLicenseTypeId == "creatorUT"):print(user)
Let me know if you have any issues with the above.
Thanks,
Ben
If this answer was helpful please mark it as helpful. If this answer solved your question please mark it as the answer to help others who have the same question.
I still get an error. I tried something similar to what you proposed. It is the user type that I have issues with.
---------------------------------------------------------------------------AttributeError Traceback (most recent call last)<ipython-input-2-8fcaf853ac6d> in <module> 2 response = group.get_members() 3 for user in response['users'] :----> 4 if(user.userLicenseTypeId == "creatorUT"): 5 print(user)AttributeError: 'str' object has no attribute 'userLicenseTypeId'
Hey Jeff Timm,
So I just checked the API and the group.get_memebers() returns an array of usernames and not user objects like I thought it would. I think if you change it to something like this you will have some better luck:
group = gis.groups.get("6bde3136acbb48bcba1edc2eca61eac6")
response = group.get_members()
for username in response['users'] :user = gis.users.get(username)
if(user.userLicenseTypeId == "creatorUT"):print(user)