Oleksii
Oleksii

Reputation: 1549

Deleting Dynamics365 systemuser via API

Does anyone know if there is a way to delete Dynamics365 systemuser via API?

If I look at: https://learn.microsoft.com/en-us/powerapps/developer/common-data-service/reference/entities/systemuser - I don't see delete action described.

Also, if I run api/data/v9.1/systemusers(11111111-1111-1111-111-111111111111) - PATCH works fine and changes user properties, but if I use DELETE, it says:

The 'Delete' method does not support entities of type 'systemuser'.

Is there a way to delete systemuser via API?

Thanks in advance

Upvotes: 0

Views: 1123

Answers (1)

Sergey Tunnik
Sergey Tunnik

Reputation: 448

The idea behind this is that user record is so important that D365 disallows anybody to delete them. And this approach has reasons. For example what would be with audit records, modified by or created by lookups, etc.

The most sensible substitute of delete would be to reassign all records from user, remove all roles and disable user (set isdisabled).

If you are using on-premise and brave enough, you can delete it directly from DB. But I wouldn't ever do it.

Upvotes: 2

Related Questions