Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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).]

share|improve this question
    
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 Answers 2

up vote 2 down vote accepted

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();
share|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
    
Yes, you are right. I forgot about that. Thanks –  m.jedrzej Oct 24 '12 at 10:42
    
hi...thanx for ur answer...but i want to do that by programmatically... –  varna Oct 24 '12 at 11:11
    
hi....thank u so much....its working fine.... –  varna Oct 24 '12 at 12:15
    
Ok, you can mark this answer as correct so other can find it. –  m.jedrzej Oct 24 '12 at 12:17

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])"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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