Closed MSLTrebesch closed 1 year ago
You need to use the UserManager.assign_categories method.
1). Define the categories
>>> category_dict = {"memberCategorySchema": [
{"title": "Categories",
"categories": [
{"title": "Office Location"},
{"title": "Department"}
]
}
]
}
>>> gis.users.categories = category_dict
2). Assign the categories
>>> gis.users.assign_categories(users=[gis.users.me], categories=['Office Location'])
You need to use the UserManager.assign_categories method.
1). Define the categories
>>> category_dict = {"memberCategorySchema": [ {"title": "Categories", "categories": [ {"title": "Office Location"}, {"title": "Department"} ] } ] } >>> gis.users.categories = category_dict
2). Assign the categories
>>> gis.users.assign_categories(users=[gis.users.me], categories=['Office Location'])
Interesting, what if my categories are already defined via the AGOL interface? Do I need to define the categories?
also, when calling 'assign_categories' I still get this error, when used against my user object list (using 'me' for simplicity):
----> 1 gis.users.assign_categories(users=[gis.users.me], categories=['Student Lab'])
AttributeError: 'UserManager' object has no attribute 'assign_categories'
Same with:
cat_users = gis.users.search("student_user")
cat_users
>>> [<User username:student_user_1>, <User username:student_user_2>]
gis.users.assign_categories(users=cat_users, categories=["Student Lab"])
>>> AttributeError: 'UserManager' object has no attribute 'assign_categories'
What version of the python API are you using? This is newer functionality
- Python API Version '2.0.1'
What's available in our current AGOL environment
@achapkowski yes. I understand the AGOL Notebook API version is behind the functionality in the current API. Missed that. (I mistakenly thought they were synchronizing, or closer)
Describe the bug using the the UserManager module with Update. when specifying the user categories (they exist) in a list per documentation, Update throws error.
To Reproduce Steps to reproduce the behavior:
s_user is a created user object
error:
Screenshots If applicable, add screenshots to help explain your problem.
Expected behavior expected already existing user category of "Student Lab" to be applied to the provided user object
Platform (please complete the following information):
Additional context Running in ArcGIS Online Notebook as an admin user to my subscription