1

When I attempt to do

    var ctx = new SP.ClientContext("https://siteurl");
    var item = ctx
                .get_web()
                .get_lists()
                .getByTitle("Folder")
                .getItemById(1);
    item.breakRoleInheritance(false, true);

    ctx.executeQueryAsync(function () {
        ...
    });

I receive the following error from the first line

Uncaught Error: Sys.ArgumentException: Value does not fall within the expected range.

I tried following this answer but the problem still occurs.

Edit: If I do

var ctx = new SP.ClientContext("/") 

I get the error

_vti_bin/client.svc/ProcessQuery 403 (FORBIDDEN)
Cannot read property 'requestUnexpectedResponseWithStatus' of undefined

when the code is executed.

  • is above code running on same server url which you are specifying in constructor... ? are you getting error directly when above line is executed ? – Siddharth Vaghasia Nov 14 '16 at 17:06
  • @SiddharthVaghasia Yes, it's the same server url. It happens directly when I run the first line. – user3643344 Nov 14 '16 at 17:14
  • Can you post here your url you are passing to the ClientContext constructor? – Sergei Sergeev Nov 14 '16 at 18:15
  • @wjervis there is no nested function, it's happening simply from even doing it within the console @Kai it's an internal URL basically something in the gist of https://subdomain.domain.com (doing https and http doesn't work. It's not under a /sites/ like typical websites provided by our admins. – user3643344 Nov 14 '16 at 18:22
0

I found out the issue was for that for 2013, it uses the same files but different location.

<script src="/_layouts/15/init.js"></script>
<script src="/_layouts/15/MicrosoftAjax.js"></script>
<script src="/_layouts/15/sp.core.js"></script>
<script src="/_layouts/15/sp.runtime.js"></script>
<script src="/_layouts/15/sp.js"></script>

I had them all pointing to /_layouts/... instead of /_layouts/15/...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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