Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-03
4
Medium Priority
?
578 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:aqibsp82
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Pstry
ID: 33595109
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
 

Author Comment

by:aqibsp82
ID: 33595481
Thanks Pstry! but i want to do it programacally....
any idea??
0
 
LVL 4

Accepted Solution

by:
Pstry earned 500 total points
ID: 33595508
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
 

Author Comment

by:aqibsp82
ID: 33595793
thanks Pstry,
that helped :)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question