Add or Remove Users From the Departing Employees List¶
Use py42 to quickly and easily manage users on the Departing Employees list. This guide describes how to add users to and remove users from the Departing Employees list.
To add a user to the Departing Employees list, all you need to know is the user’s Code42 user UID.
To get the user UID based on username:
user = sdk.users.get_by_username("username") uid = user["users"]["userUid"]
user_id below refers to the user UID.
from py42.exceptions import Py42UserAlreadyAddedError # Add the departing employee try: response = sdk.detectionlists.departing_employee.add(user_id, departure_date) except Py42UserAlreadyAddedError: print("The user is already on the Departing Employee list.")
If the user is already in the Departing Employees list, you will get an py42.exceptions.Py42UserAlreadyAddedError.
If a detection list user profile doesn’t exist yet for this user, one will automatically be created before adding the user to the Departing Employees list.
To remove a user from the Departing Employees list:
For complete details, see Departing Employee.