This question is same as How to find the current folder through JS COM? this one. But my problem is I can't get the folder name from the root folder, For instance

Consider final is the root folder in share point. And final folder contain the several folders. I'm trying to get the folder name from the final folder, I tried with the following script this is copied from the another answer

var currentFolder = decodeURIComponent(ctx.rootFolder).split("/").pop();

This is not giving the folder name from the root folder, but it is working while directory moved into the child folders.

  /final                #Here folder name is not giving
  /final/1/             #While moving into child folder name is giving by the above code
  /final/2/             #,,,

1 Answer 1


Not the best way but I guess it will work.


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.