I created a code to remove inactive users from Portal after 90 days of inactivity.
The code runs through the list of users and removes users who have not logged in since 90 days and reassigns their content to Portal administrator.
Is there a way I can delete users who do not have any content on Portal?
I can loop in throgh the list of users but to check wherther they have content or not seems like a challange.
If required I can provide code snippets.
When looping through the users, just do a content search for all items owned by a particular user and then check the length of the list. If the length is 0, then you can delete the user.
search_result = gis.content.search(query="owner:" + userName, item_type="", max_items = 99999, outside_org=False) print(length(search_result))
Thank you for your response William . I will give it a try .
By right, this seems to be the only and correct method of checking content.