Dynamics 365 – Share Records using C# | GrantAccessRequest
It is necessary to specify the access rights to be granted to the recipient when sharing a record with another user using the GrantAccess message. If you need to modify the access of a shared record, the ModifyAccess message should be used.
For a shared record, access rights can vary for each user with whom the record is shared. It is important to note that a user cannot be given any rights that they do not already have for that particular type of table, based on the role assigned to them. For instance, if a user lacks the Read privileges for accounts and an account is shared with that user, they will be unable to view said account.
Share records by using C#
The ShareRecord static method provides an example of using the PrincipalAccess Class to designate a reference to a principal (user, team, or organization). This reference includes a set of AccessRights containing the rights to be granted to the principal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following examples demonstrate how to use the ModifyAccess message to alter the access permissions granted to a principal for a shared record.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The owner of the record has the ability to use the RevokeAccess message in order to revoke (remove) a user’s access to the shared record.
The following example demonstrates how to remove sharing access for a user to a record using the RevokeAccessRequest Class through the RevokeShare static method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Leave a comment