SharePoint: Get the Role ID

SharePoint uses role ID’s to create the permissions levels for SharePoint Groups. These role ID’s are a set of numbers that define the precise permissions level details.
The most used role ID are for Visitors (Read), Members (Contribute) and Owners (Full control). When you need other permission levels, creating the correct numbers can be difficult. With the help of the following steps it will be easy to create/find the role ID’s you need. This solution works for SharePoint Online and SharePoint 2013. The role ID’s are used when setting permissions using a rest call, see the blog post SharePoint 2013 Workflow: Changing Permissions with REST Calls for the details.

Permissions level  Role ID
Full Control 1073741829
Contribute 1073741827
Read 1073741826

Solution

  1. Open the SharePoint 2013 or Online site.
  2. Create the required Permission level on the Site Collection
  3. Go Site Settings – Site Permissions
  4. Open the Permission Levels
  5. Create a custom permission level, in this example I created a permission level called Custom Contribute.
  6. Now we need to find the corresponding role ID
  7. Create the following URL for your farm / site
    https://contoso.sharepoint.com/sites/dev/_api/web/roledefinitions
    
  8. This will open a page which looks like an RSS feed.
  9. Right click on the page to View Source, this will open the Source in Notepad.
  10. Now copy the code into your favorite XML editor.
  11. Search the XLM for the correct entry
  12. The Role ID is located in the link tag. The Role ID for my custom permission level is 1073741927
  13. The Role ID can now be used in web services, see the blog post SharePoint 2013 Workflow: Changing Permissions with REST Calls for the details.
Share

One Reply to “SharePoint: Get the Role ID”

  1. Hello,

    First of all thank you for the tutorial. I’m having a problem with the SP.Web.ShareObject method.
    It requires a parameter “roleValue” which normally shoul accept any role id (from what I saw in other topics), but I’m getting a “selected permission level is not valid” error message.
    Do you know perhaps the reason ?

    Thanks.

Leave a Reply

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