Item Level Permissions and Code Access

Item Level Permissions and Code Access

In this article we can explore how Item Level Permissions behave in Code Access scenario.

Item Level Permissions

We can enable Item-level Permission on a list so that only the Creator will be able to Read the item.  For other users the item won’t be displayed.

As an Administrator, you can go to the List > List Settings > Advanced Settings to enable Item-level Permissions.


Testing from Browser Access

Create a new item as Administrator User.


Now login as a different User who is just a Contributor.  You won’t’ be able to see the Admin item now.


Now create a new item.


Now login back as the Administrator or Site Owner & You can see both the items.


Site Collection Administrator or Site Owner can view all the Use Items.

Testing from Code Access

Now let us see the Item-level Permission applies to Code Access as well.  For this I am using CSOM Code with/without Network Credential class.

By default the code runs under Login User which is Administrator.

static void Main(string[] args)


ClientContext context = new ClientContext(“http://sharepoint“);

List list = context.Web.Lists.GetByTitle(“Restricted Contacts”);

ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());



foreach (var item in items)







Executing the Code you can see both the items are displayed.  Since we are Administrator user now.


Now apply the Contributor User Credential to test the User Context.

ClientContext context = new ClientContext(“http://sharepoint“);

context.Credentials = new NetworkCredential(“tim”, “Welcome123”);


This concludes that Item-level Permission applies to Code Access as well & Site Collection Administrators or Site Owner can view all items in both browser & code access scenario.


Item-level Permissions is a great feature.  Without this we would have required custom code to break the permission & assign permission to the created user.



In this article we have explored Item Level Permissions & CSOM Code with different User Contexts.


Leave a Reply

Your email address will not be published. Required fields are marked *