CrmService service = new CrmService();
service.Credentials = ......passare credenziali di amministratore
SecurityPrincipal principal = new SecurityPrincipal();
principal.Type = principalType;
principal.PrincipalId = entityId; //guid del team o systemuser
PrincipalAccess principalAccess = new PrincipalAccess();
principalAccess.Principal = principal;
principalAccess.AccessMask = AccessRights.ReadAccess | AccessRights.WriteAccess; //tipi di accesso
TargetOwnedAccount target = new TargetOwnedAccount();
target.EntityId = accountId;
ModifyAccessRequest request = new ModifyAccessRequest();
request.PrincipalAccess = principalAccess;
request.Target = target;
service.Execute(request);