({{, (RefLink[PartProtection, paclet:ref/PartProtection]) 
is an option for cloud expressions that controls which parts of their structure can be changed.}})

OpenersNotesSection(Spacer1)Details

The setting for (RefLink[PartProtection, paclet:ref/PartProtection]) specifies which parts of lists and associations in a cloud expression are protected from being modified in place.

Possible settings include:

When a change is attempted on a part of a cloud expression not allowed by the setting of (RefLink[PartProtection, paclet:ref/PartProtection]), a (RefLink[Failure, paclet:ref/Failure]) object is returned.

With the setting (RefLink[PartProtection, paclet:ref/PartProtection])->(RefLink[All, paclet:ref/All]), deleting the cloud expression using (RefLink[DeleteCloudExpression, paclet:ref/DeleteCloudExpression]) and resetting its value with (RefLink[Put, paclet:ref/Put]) are still allowed.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create a (RefLink[CloudExpression, paclet:ref/CloudExpression]) storing a scoreboard:

scores=CreateCloudExpression[<|
"user1"->\[LeftAssociation]"best"->12,"attempts"->5\[RightAssociation],"user2"->\[LeftAssociation]"best"->7,"attempts"->2\[RightAssociation]|>]

Check that the (RefLink[PartProtection, paclet:ref/PartProtection]) is set to (RefLink[Automatic, paclet:ref/Automatic]):

Options[scores, PartProtection]

Increment the number of attempts of user "user2", which is an atomic subpart of the cloud expression:

scores["user2","attempts"]++

Append a new user:

AppendTo[scores,"user3"-><|"best"->5,"attempts"->3|>];

Retrieve the latest value:

Get[scores]

Attempt to modify the value of key "user1", whose value is an association:

scores["user1"]=15

Disable part protection:

SetOptions[scores,PartProtection->None]

scores["user1"]=15

The modification was applied:

Get[scores]

Create a new cloud expression with full part protection:

data=CreateCloudExpression[{1,2,3},PartProtection->All]

Try to append a value:

AppendTo[data, 4]

Set the part protection to (RefLink[None, paclet:ref/None]) and try again:

SetOptions[data,PartProtection->None];

AppendTo[data,4];

Retrieve the updated value:

Get[data]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CloudExpression, paclet:ref/CloudExpression])  ▪  (RefLink[CreateCloudExpression, paclet:ref/CreateCloudExpression])  ▪  (RefLink[Permissions, paclet:ref/Permissions])  ▪  (RefLink[SetOptions, paclet:ref/SetOptions])  ▪  (RefLink[Options, paclet:ref/Options])  ▪  (RefLink[Protected, paclet:ref/Protected])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Structured Data in the Cloud, paclet:guide/StructuredDataInTheCloud])}})}})