Hi,
Here is the code for un sharing record in CRM using C# code.
/// <summary>
/// Un shares the Record from Team or User.
/// </summary>
/// <param name="service">CRM Organization Service</param>
/// <param name="erfTargetEntity">Target Entity Reference</param>
/// <param name="erfTeamOrUser">Team or User Entity Reference</param>
public void UnShareRecord(IOrganizationService service, EntityReference erfTargetEntity, EntityReference erfTeamOrUser)
{
ModifyAccessRequest modif = new ModifyAccessRequest();
modif.Target = erfTargetEntity;
PrincipalAccess principal = new PrincipalAccess();
principal.Principal = erfTeamOrUser;
principal.AccessMask = AccessRights.None;
modif.PrincipalAccess = principal;
ModifyAccessResponse modif_response = (ModifyAccessResponse)service.Execute(modif);
}
Refer this link for sharing record.
Hope this helps.
--
Happy CRM'ing
Gopinath
Here is the code for un sharing record in CRM using C# code.
/// <summary>
/// Un shares the Record from Team or User.
/// </summary>
/// <param name="service">CRM Organization Service</param>
/// <param name="erfTargetEntity">Target Entity Reference</param>
/// <param name="erfTeamOrUser">Team or User Entity Reference</param>
public void UnShareRecord(IOrganizationService service, EntityReference erfTargetEntity, EntityReference erfTeamOrUser)
{
ModifyAccessRequest modif = new ModifyAccessRequest();
modif.Target = erfTargetEntity;
PrincipalAccess principal = new PrincipalAccess();
principal.Principal = erfTeamOrUser;
principal.AccessMask = AccessRights.None;
modif.PrincipalAccess = principal;
ModifyAccessResponse modif_response = (ModifyAccessResponse)service.Execute(modif);
}
Refer this link for sharing record.
Hope this helps.
--
Happy CRM'ing
Gopinath
No comments:
Post a Comment