Prevent SP2010 list from adding new Items and Editing existing items.

Hi,
can anyone please tell me if there is a way to prevent SharePoint 2010 list from adding new Items and Editing existing items through program (probably in Schema file of list).
thanks
aqibsp82Asked:
Who is Participating?
 
PstryConnect With a Mentor Commented:
In C#:

SPList list;

// list = .... // load your existing list
list.WriteSecurity = 4; // 1="All items", 2="Own items", 4 = "None"
list.Update();

if you want to create list from schema - edit Elements.xml, as in the following example (full template omitted for brevity). Note "4" in "SecurityBits":

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ListTemplate
      .....
      SecurityBits="14"
      ....
    />
</Elements>
0
 
PstryCommented:
I think that the simplest solution is to change list security. Just remove contributor permissions (or change them to read).

The second possibility is:

- go to the advanced list settings
- in "Item-level Permissions" section select "None" in "Create and Edit access".

The latter solution does not work in document library.

 

Item-Level-Permissions.png
0
 
aqibsp82Author Commented:
Thanks Pstry! but i want to do it programacally....
any idea??
0
 
aqibsp82Author Commented:
thanks Pstry,
that helped :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.