---
title: "Getting the permission levels from SharePoint 2010 using C#"  
description: "In this article I am going to explain how to get all the permission levels in sharePoint 2010 using C#.  Steps involved:Go to Visual Studio 2010.Go to"  
author: "Chris Anderson"  
published: 2011-12-14  
updated: 2020-07-26  
canonical: https://www.mindstick.com/articles/848/getting-the-permission-levels-from-sharepoint-2010-using-c-sharp  
category: "sharepoint"  
tags: ["sharepoint"]  
reading_time: 1 minute  

---

# Getting the permission levels from SharePoint 2010 using C#

In this article I am going to explain how to get all the permission levels in sharePoint 2010 using C#.\

##### Steps involved:

- Go to Visual Studio 2010.
- Go to File à New à Project.
- Select Windows Application and apply the following settings to your project: \ Target Framework: **.****NET 3.5**\ Build output: **AnyCpu**(or x64)
- Click Add.

![Getting the permission levels from SharePoint 2010 using C#](https://www.mindstick.com/mindstickarticle/06e20e89-d95f-45a2-b3cd-7fd011ed8738/images/6c57946a-0efc-42eb-bad2-8eeab4a7aeff.png)

![Getting the permission levels from SharePoint 2010 using C#](https://www.mindstick.com/mindstickarticle/06e20e89-d95f-45a2-b3cd-7fd011ed8738/images/05ebaca1-bc9d-4ea6-90c2-98d50e76c408.png)

Next, we need to add references. Right click the “**References**” node and choose **“Add Reference”**.

![Getting the permission levels from SharePoint 2010 using C#](https://www.mindstick.com/mindstickarticle/06e20e89-d95f-45a2-b3cd-7fd011ed8738/images/37cefd93-19a5-4e1a-8967-4cf9c81a56e7.png)

· Choose **Browse**:

· Go to the following location: **C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI.**

· Select **Microsoft.SharePoint.dll**files**:**

Add the following code in the Program.cs file:

```
using System;using System.Collections.Generic;using System.Text;using Microsoft.SharePoint; namespace SampleApplication1{    class Program    {        static void Main(string[] args)        {            using (SPSite site = new SPSite("http://rohit:34143/"))      
     {                using (SPWeb web = site.RootWeb)                {                    SPRoleDefinitionCollection roleColl = web.RoleDefinitions;                    foreach (SPRoleDefinition role in roleColl)                    {                
       Console.WriteLine(role.Name.ToString());                    }                    Console.ReadLine();                }            }        }    }}
```

##### Output:

![Getting the permission levels from SharePoint 2010 using C#](https://www.mindstick.com/mindstickarticle/06e20e89-d95f-45a2-b3cd-7fd011ed8738/images/332baf32-7a38-4b29-b86e-b409db48305b.png)

Thanks for reading this article. I think this will help you a lot.

\

---

Original Source: https://www.mindstick.com/articles/848/getting-the-permission-levels-from-sharepoint-2010-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
