< Back

Set-CrmRecordAccess

Sat Jan 18, 2020 4:06 pm

NAME Set-CrmRecordAccess



SYNOPSIS

Sets a security principal's (user or team) access to the specified record.





SYNTAX

Set-CrmRecordAccess [[-conn] <CrmServiceClient>] [-CrmRecord] <PSObject[]> [-Principal] <EntityReference>

[-AccessMask] <AccessRights> [<CommonParameters>]



Set-CrmRecordAccess [[-conn] <CrmServiceClient>] [-EntityLogicalName] <String> [-Id] <Guid> [-Principal]

<EntityReference> [-AccessMask] <AccessRights> [<CommonParameters>]





DESCRIPTION

The Set-CrmRecordAccess cmdlet sets a security principal's (user or team) access to the specified record. The

operation creates access rights if none exist, or replaces existing access rights. That is, if a principal has

been granted pre-existing access rights to a record, any access rights specified in executing this cmdlet are

granted and any existing access rights not specified are removed. Note that the append right requires both

AppendAccess and AppendToAccess to be specified.





PARAMETERS

-conn <CrmServiceClient>

A connection to your CRM organization. Use $conn = Get-CrmConnection <Parameters> to generate it.



Required? false

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CrmRecord <PSObject[]>

The record object to grant access to, obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then

you don't use EntityLogicalName/Id.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Principal <EntityReference>

The principal (user or team) being granted access rights to the record. Use New-CrmEntityReference

<Parameters> to generate it.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AccessMask <AccessRights>

The access rights to grant the principal over the record. Assign multiple values to generate the full value,

e.g. AppendAccess,ReadAccess,WriteAccess.



Required? true

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EntityLogicalName <String>

The logical name of an entity to grant access to, i.e. account, contact, lead, etc.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <Guid>

The Id of a record to grant access to.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS









OUTPUTS









NOTES









-------------------------- Example 1 --------------------------



Set-CrmRecordAccess -conn $conn -CrmRecord $contact -Principal $team -AccessMask

AppendAccess,AppendToAccess,ReadAccess,WriteAccess



This example grants a team append, read, and write access to a contact record. Any other access rights previously

assigned would be revoked.







-------------------------- Example 2 --------------------------



$contact | Set-CrmRecordAccess -conn $conn -Principal $team -AccessMask ReadAccess,WriteAccess,DeleteAccess



This example pipes a contact to Set-CrmRecordAccess and grants a team read, write, and delete access to it.









RELATED LINKS