答えて

0

、あなたはCAMLクエリで 'FileDirRef' プロパティを指定し、 'RecursiveAll' スコープを追加する必要があります。

var camlQuery = new SP.CamlQuery(); 
camlQuery.set_viewXml(
    '<View Scope="RecursiveAll"> " + 
     "<Query>" + 
      "<Where>" + 
       "<Eq>" + 
        "<FieldRef Name="FileDirRef" />" + 
        "<Value Type=\"Text\">yourFolderPath</Value>" + 
       "</Eq>" + 
      "</Where>" + 
     "</Query>" + 
    "</View>'); 
0
function GetFolders() { 
var oWeb = _spPageContextInfo.webAbsoluteUrl; 
var URLC = oWeb + "/_api/web/lists/getByTitle('ListName')/items"; 
$.ajax({ 
    url: URLC, 
    method: "GET", 
    headers: { "Accept": "application/json; odata=verbose" }, 
    async: false, 
    cache: false, 
    success: function (data) { 
     $.each(data.d.results, function (index, item) { 
      $.ajax({ 
       url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('ListName/ListFolder)/listitemallfields/", 
       method: "GET", 
       headers: { "Accept": "application/json; odata=verbose" }, 
       async: false, 
       cache: false, 
       success: function (data) { 
       } 
      });    
     }) 
    }, 
    error: function (data) { } 
}); 

}

0

あなたが読むためにREST APIを使用することができますgetfolderbyserverrelativeurlを使用して、特定のフォルダのアイテムを一覧表示します。

コードの下に参照してください:

var folderRelativeUrl = "Relative_URL_Of_Your_Folder"; //here specify relative URL of your folder (e.g. '/Shared Documents') 


getItemFromFolder().then(getItemFromFolderSuccess, getItemFromFolderFailed); 


function getItemFromFolder(){ 
    return $.ajax({ 
     url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/getfolderbyserverrelativeurl('" + folderRelativeUrl + "')/files?$expand=ListItemAllFields", 
     type: "GET", 
     headers: { 
      "Accept": "application/json;odata=verbose" 
     } 
    }); 
} 

function getItemFromFolderSuccess(data){ 
    // success handler 
    var response = data.d.results; // This is Response Object from Server 
} 

function getItemFromFolderFailed(error){ 
    // error handler code 
} 
関連する問題