Sharepoint - REST: set ReadSecurity / WriteSecurity (Item Level Permissions)
It is possible to set or update ReadSecurity or WriteSecurity using REST API and JSOM both.
REST API
Request body
{
"__metadata": {
"type": "SP.List"
},
"ReadSecurity": 2,
"WriteSecurity": 4
}
End-point
/_api/web/lists/getbytitle('{List Name}')
You need to make an UPDATE
request to above end-point with above request body. I have tested it using My SP REST Client.
More about ReadSecurity & WriteSecurity
ReadSecurity
& WriteSecurity
do not appear in response when you make a GET
request to the list end-point but it returns all properties those are mentioned in MSDN. I mean following end-point
/_api/web/lists/getbytitle('{List Name}')
But if use $select
operator in your query, then you will get the value of ReadSecurity
& WriteSecurity
. I mean following
/_api/web/lists/getbytitle('{List Name}')?$select=ReadSecurity,WriteSecurity
The reason is: these (ReadSecurity
& WriteSecurity
) properties are not returned with the resource. See more on Getting properties that aren't returned with the resource.
JSOM
Set value using
yourList.set_readSecurity(2)
yourList.set_writeSecurity(4)
Get value using
yourList.get_readSecurity()
yourList.get_writeSecurity()