Has anyone found a way to enumerate folders within a generic list?
SiteData EnumerateFolder returns a list of folders and files. It works well with document libraries, but not with generic lists. With generic lists, like those under the Lists folder, it only return file names. No folder names are ever returned. This was tested in both WSS and MOSS 3.0 (SP2007) and appears to be a limitation of the web service. Thank you.
Example page:
SiteData EnumerateFolder returns a list of folders and files. It works well with document libraries, but not with generic lists. With generic lists, like those under the Lists folder, it only return file names. No folder names are ever returned. This was tested in both WSS and MOSS 3.0 (SP2007) and appears to be a limitation of the web service. Thank you.
Example page:
<!doctype html>
<html>
<head>
<title>page</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js"></script>
</head>
<body>
<script type='text/javascript'>
$(document).ready( function() {
// OK - returns folders and files for document library
$().SPServices({
operation: 'EnumerateFolder',
strFolderUrl: 'Documents',
completefunc: output
});
// FAIL - returns files, but not folders for generic list
$().SPServices({
operation: 'EnumerateFolder',
strFolderUrl: 'Lists/Calendar',
completefunc: output
});
})
function output( data ) {
$('textarea').val( $('textarea').val() + '\n\nOUTPUT:\n' + data.responseText );
}
</script>
<h3>EnumerateFolders</h3>
<textarea style="width:100em;height:40em;padding:1em;"></textarea>
</body>
</html>