I'm trying to get the properties of the subfolders using jsom. Let's say: name, url, etc

I'm using this:

var ctx = new SP.ClientContext(currentSite);
web = ctx.get_web();
list = web.getFolderByServerRelativeUrl(subfolderURL);


And I'm getting the following error:

Invalid request

If I try to load the subfolder only:


I don't have the error but I'm not able to access the properties of the subfolder.

Am I doing something wrong?


When you want to retrieve properties for a single item/folder/list/etc and not a collections of items/folders/lists/etc you need to specify properties like this:

ctx.load(list, 'Name', 'Url', 'other_property_here');

Basically, you DON'T use Include(), but specify the properties as comma-separated arguments in the ctx.load() function.

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.