Пример демонстрационного скрипта (проверьте FSObjType, если хотите различить guish папка / файл):
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sharepointplus/browser/sharepointplus.js"></script>
<script type="text/javascript">
function getFolderAndFilesInFolder() {
// if you want to list only the files visible into a folder for a Document Library
$SP().list("MyDoc2").get({
fields: "BaseName,FileRef,FSObjType", // "BaseName" is the name of the file/folder; "FileRef" is the full path of the file/folder; "FSObjType" is 0 for a file and 1 for a folder (you need to apply $SP().cleanResult()), "File_x0020_Size" the filesize in bytes
folderOptions: {
path: "folder",
show: "FilesAndFolders_InFolder"
}
}).then(function (items) {
for (var i = 0; i < items.length; i++) {
console.log(items[i].getAttribute("FileRef"));
console.log(items[i].getAttribute("FileLeafRef"));
//console.log(items[i].getAttribute("FSObjType"));
}
})
}
</script>
<input id="Button1" type="button" onclick="getFolderAndFilesInFolder()" value="button" />
[setup.folderOptions.show = "FilesAndFolders_InFolder"] Четыре значения: "FilesOnly_Recursive msgstr "который перечисляет все файлы рекурсивно по указанному пути (и его дочерним элементам); «FilesAndFolders_Recursive», который рекурсивно перечисляет все файлы и папки по указанному пути (и его дочерним элементам); «FilesOnly_InFolder», в котором перечислены все файлы из указанного пути; «FilesAndFolders_InFolder», в котором перечислены все файлы и папки по указанному пути