Configure the employeeLeaveDateTime property for a user
This article describes how to configure the employeeLeaveDateTime attribute for a user. This property can be used as a trigger for "leaver" workflows created using Lifecycle Workflows.
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | User.Read.All and User-LifeCycleInfo.ReadWrite.All | Not available. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | User.Read.All and User-LifeCycleInfo.ReadWrite.All | Not available. |
For delegated scenarios, the admin must also have the Global Administrator Microsoft Entra role.
Note
This information is best updated via automation by using either an HR provisioning, Microsoft Entra Connect, or custom sync solution. For more information about this process, see How to synchronize attributes for lifecycle workflows.
Set the employeeLeaveDateTime property
Request
The following example configures September 30, 2022 at 23:59 as the date and time when the user will leave the organization.
PATCH https://graph.microsoft.com/v1.0/users/aaaaaaaa-bbbb-cccc-1111-222222222222
{
"employeeLeaveDateTime": "2022-09-30T23:59:59Z"
}
Reset the employeeLeveDateTime property back to null
The request returns a 204 No Content
response code.
PATCH https://graph.microsoft.com/v1.0/users/aaaaaaaa-bbbb-cccc-1111-222222222222
{
"employeeLeaveDateTime": null
}