Posts Tagged ‘Sharing’

private bool RevokeAccessToEntity(ICrmService service, Guid guidValue, Guid entityID, string EntityName) { bool isSuccess = false; // Create the SecurityPrincipal object. SecurityPrincipal principal = new SecurityPrincipal(); // PrincipalId is the GUID of the team whose access is being revoked. principal.Type = SecurityPrincipalType.Team; principal.PrincipalId = guidValue; // Create the target for the request. TargetOwnedDynamic target = new [...]

using  System; using System.Collections.Generic; using System.Text; using Microsoft.Crm.Sdk; using Microsoft.Crm.SdkTypeProxy; using Microsoft.Crm.Sdk.Query; namespace CRM.Customization.Sharing { public class SharingRecord:IPlugin { string teamId = string.Empty; #region IPlugin Members public void Execute(IPluginExecutionContext context) { DynamicEntity entity=null ; if (context.InputParameters.Properties.Contains(“Target” ) && context.InputParameters.Properties["Target"] is DynamicEntity ) { entity = (DynamicEntity)context.InputParameters.Properties["Target" ]; Guid recordId=(Guid)context.OutputParameters.Properties["id" ]; ICrmService service = context.CreateCrmService(true ); // [...]