Skip to content

Instantly share code, notes, and snippets.

@furkankaracan
Created April 4, 2024 14:21
Show Gist options
  • Save furkankaracan/44bd56d882df2e2e1c6b1058b2057bb1 to your computer and use it in GitHub Desktop.
Save furkankaracan/44bd56d882df2e2e1c6b1058b2057bb1 to your computer and use it in GitHub Desktop.
/// <summary>
/// Modifies the access to a shared record.
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
/// <param name="principal">The user, team, or organization to modify rights to the shared.</param>
/// <param name="access">The access rights to modify</param>
/// <param name="record">The shared record</param>
static void ModifyShare(
IOrganizationService service,
EntityReference principal,
AccessRights access,
EntityReference record)
{
PrincipalAccess principalAccess = new()
{
AccessMask = access,
Principal = principal
};
ModifyAccessRequest request = new()
{
PrincipalAccess = principalAccess,
Target = record
};
service.Execute(request);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment