@Ahmed Alshatawi Thanks for posting in our Q&A.
1.If you want to lock the device after the inactive time, it is suggested to create a custom profile to make it.
Creating a custom profile and deploy this profile to the device group you want.
Name: ScreenLock
OMA-URI: ./Device/Vendor/MSFT/Policy/Config/DeviceLock/MaxInactivityTimeDeviceLock DataType:Integer
Value: (Value in minutes you want)
2.If you want to sleep the device, there are some settings under Settings catalog.
Allow Hibernate
Unattended Sleep Timeout Plugged In
Unattended Sleep Timeout On Battery
Hope it is what you want.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.