[Ribbon Region] List Tools -> [Tab] List -> [Group] Settings -> [Button] List Settings
On the list settings page select
[Region] General Settings -> [Link] Advanced settings -> [Region] Item-Level Permissions
You should see something like this:
This is great because it enables me to do a lot of the stuff I have done with event revievers before, so it saves me a lot of code.
But of course I want to set these in code, for being able to deploy my development by menas of an wsp-file. Say I want to configure the list in a way that a user can only see and edit the items he created. I was browsing thorugh the properties of the SPList-object and found something that seems a little bit like a hack to me, but here is the way it goes:
SPList myList = GetMyList();
myList.ReadSecurity = 2;
myList.WriteSecurity = 2;
myList.Update();
Yeah, belive it or not, those two are integer fields. According to MSDN we can set the following values for ReadSecurity:
- 1 - All users have Read access to all items.
- 2 - Users have Read access only to items that they create.
- 1 — All users can modify all items.
- 2 — Users can modify only items that they create.
- 4 — Users cannot modify any list item.
Enjoy!
Keine Kommentare:
Kommentar veröffentlichen