0

i want the coding for People can view the item which was added by them in the list..... [i need to add item in custom splist but that was not able to view by anyone...likewise people who are adding item in the same list which was not able to view by others(i gave permission to view my Splist for the user).]

  • I'm sorry can you please reword your question to attempt it to be a little clearer? – Hugh Wood Oct 24 '12 at 10:02
  • 1
    Hi Hugh Wood.... For example if A has added some items to SPlist, and B has added some items to same SPlist. Now my requirements as follows: A shouldnot able to see what B has added and B should not able to see what A has added ... Please Try to find answer ASAP.. Thanx in advance... – varna Oct 24 '12 at 10:23
2

If I understood you correctly you need to set up Item-level Permissions.

Go to list settings -> advanced settings and set Item-level Permissions Read: Read items that were created by the user .

Edit after Ksesh comment:

Also set Create and Edit access to : Create items and edit items that were created by the user

Edit programmatically in shortcut:

   SPList spList = SPContext.Current.Web.Lists["MyList"];
   spList.ReadSecurity = 2;
   spList.WriteSecurity = 2;
   spList.Update();
| improve this answer | |
  • 1
    Plus I think permissions to create and change should be also changed to "created by a user" – Ksesh Oct 24 '12 at 10:40
  • hi...thanx for ur answer...but i want to do that by programmatically... – varna Oct 24 '12 at 11:11
  • Ok, you can mark this answer as correct so other can find it. – m.jedrzej Oct 24 '12 at 12:17
  • hi jedrzej...how to set security for listitem programatically.i have two radio button.(i)view by every one (ii)me only...if i select 'view by every one' radiobutton when i add item to list.that item able to view by everyone.if i select 'me only'.then that item ll view by me ly.plz help me...is there any property to do this..thanx in advance.. – varna Oct 25 '12 at 5:12
0

This can be done without any line of code also i.e. Item-level Permissions in order to do that

  1. Move to List Setting of said list.
  2. Move to views in the page.
  3. Click on "All Items".
  4. Move to the filter.
  5. check "Show items when the following is true"
  6. Put the condition Created By "Is equal To" TYPE([Me])
  7. Click on OK.

in short you need to put filter on public view for condition "Created By "Is equal To" TYPE([Me])"

| improve this answer | |

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.