How can I check the site permissions of the current user using the SharePoint Framework? How would I go about recreating the following:

var ctx = new SP.ClientContext.get_current();
var web = context.get_web();

var ob = new SP.BasePermissions();

var per = web.doesUserHavePermissions(ob)
         alert(per.get_value()); // true if user has permission 
         alert ("Something wrong");

4 Answers 4


Most of this comes along for free. The current list item is


The current web is

  • @PatMil_MSFT How to load SharePoint groups?
    – Mihir
    Jan 10, 2018 at 12:34

You need to install the typings for Microsoft AJAX and JSOM. To do that run the below commands:

tsd install microsoft.ajax

tsd install sharepoint

After that, you need to add the config.json you need to add below entries:

    "sp-init": {
     "path": "https://tenantname.sharepoint.com/_layouts/15/init.js",
     "globalName": "$_global_init"
    "microsoft-ajax": {
     "path": "https://tenantname.sharepoint.com/_layouts/15/MicrosoftAjax.js",
     "globalName": "Sys",
     "globalDependencies": [ "sp-init" ]
    "sp-runtime": {
     "path": "https://tenantname.sharepoint.com/_layouts/15/SP.Runtime.js",
     "globalName": "SP",
     "globalDependencies": [ "microsoft-ajax" ]
    "sharepoint": {
     "path": "https://tenantname.sharepoint.com/_layouts/15/SP.js",
     "globalName": "SP",
     "globalDependencies": [ "sp-runtime" ]

Once you have added the entries, you need to add require statements for them in your webpart as below:


After that, inside your render method , you can use that JSOM code that you posted above.

  • Please, don't give advise to use tsd. tsd is a deprecated tool long long time ago. Today you need to use either ms types publisher aka @types or typings npm tool or both. Feb 1, 2017 at 11:38
  • @SergeiSergeev - sure will keep this in mind :) Also, you rock, your answers are a source of great inspiration to me and they keep me reminded of how little I know about the SP universe !!! Feb 1, 2017 at 11:46
  • WOW! Thanks! Your help is also extremely valuable. You are the top by rating per month for several months! Keep your good work and thank you too! Feb 1, 2017 at 11:50

You can either use JSOM after importing it like @gautam-sheth specifies.

Or you can use the SharePoint REST interface at:

https://<site url>/_api/web/doesuserhavepermissions(@v)?@v={'High':'0', 'Low':'262144'}

The high and low values specified is for AddAndCustomizePages.


To solve this I loaded JSOM but couldn't do it from the config.json because I needed a solution that would run from any tenant using relative paths to the external libraries.

I used the web part to load a js file containing the following code. I don't know if this is the best answer, but it worked.

requirejs.config({ enforceDefine: false });

var requireQueue = function (modules, callback) {
    function load(queue, results) {
        if (queue.length) {
            require([queue.shift()], function (result) {
                load(queue, results);
        } else {
            callback.apply(null, results);
    load(modules, []);

], function () {
    // JSOM is loaded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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