In most of the cases when we want to limit users of our CRM organization, or give them privileges to do something, we are going to have to retrieve a list of all the users in the system. Thankfully, all the users in CRM are stored in a separate table called “SystemUser”. This table records can then be forked through the CRM SDK REST. This is done in the following manner:

retrieveUsers

After retrieving all the users from this list we will see that not all of them are what we really want, and what we want are users that are licensed, users that can actually log in and do stuff in our CRM organization. That is why we can, while retrieving this list, use OData filters and fetch exactly what we need. If we need only licensed users then in the OData filter part we would specify something like this: “$filter=IsLicensed eq true”

filtered

This would then give us a list of all the users who have been given a license.

The very same thing (retrieving users) in C# would be quite straightforward then.

c#

Retrieved user entity will then give us a very long list of attributes based on which we can develop our business logic and through plugin limit what they can or cannot do in our Crm organization.