11

Is it possible to set this with REST (or JSOM?)

(these are not exposed as properties in List REST endpoint: MSDN List)

I can set this:

with PowerShell:

$spList.ReadSecurity=2 # 1=read all items, 2=read items created by user
$spList.WriteSecurity=4 # 1=Create and edit All, 2=Create and edit Own items, 4=None
  • There is at least one reason for which you should avoid item level permissions : it affects page load performance. Not only that, there is also a limit of 50000 unique permissions per site collection. You should probably consider a better alternative. Maybe use an event receiver. – Nisarg Mar 12 '16 at 7:42
  • 1
    I think this is a common misconception; This setting of Item Level Permissions is not the same as Item Level Security, with the latter your Break Security and use (custom) Permission Profiles (that's where the confusion starts with the word "Permission" having different meanings). Al the performance/50000 items comments are about Item Level Security – Danny '365CSI' Engelman Mar 13 '16 at 13:14
  • 2
    Created separate question on this threshold / security / permission: sharepoint.stackexchange.com/questions/173845/… – Danny '365CSI' Engelman Mar 13 '16 at 14:19
  • 2
    ReadSecurity and WriteSecurity are included in the SchemaXML that can be requested using REST API but I don't see any way to update the values with REST. – Suleyman May 31 '16 at 8:56
3

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.

enter image description here

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()
  • 3
    Thanks a lot. Apperently only works in SharePoin online, it does NOT work for ON PREM – Chris DS Mar 8 '17 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.