Share MS CRM Task

Di seguito il codice c# per condividere un task CRM ad un Team...
Questa operazione è eseguibile unicamente via codice.

SecurityPrincipal principal = new SecurityPrincipal();
principal.Type = SecurityPrincipalType.Team; //avrei potuto scegliere anche User...
principal.PrincipalId = teamID;
PrincipalAccess principalAccess = new PrincipalAccess();
principalAccess.Principal = principal;

//Imposto i diritti sullo share del task
principalAccess.AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess | AccessRights.DeleteAccess;

//Si puo' scegliere anche specificando TargetOwnedAccount...
//ma TargetOwnedDynamic andrà bene per tutte le entità: nel nostro caso
//scegliamo EntityName.task.ToString();

TargetOwnedDynamic target = new TargetOwnedDynamic();
target.EntityId = taskID;
target.EntityName = EntityName.task.ToString();

//Impongo i criteri di share
ModifyAccessRequest request = new ModifyAccessRequest();
request.PrincipalAccess = principalAccess;
request.Target = target;
CrmService.Execute(request);


Ciao
Rob

posted @ mercoledì 24 gennaio 2007 12:34

Print