mardi 9 décembre 2014

What is better way to enum directories and documents



I need to enum directories and documents in SP 2013. I need only those the user works with (no system or web files) To get initial lists omitting non-user ones I inquire



/_api/Web/Lists?$filter=BaseType+eq+1 and Hidden+eq+false and IsPrivate+eq+false and IsCatalog+eq+false


Than - what to do better? I have 2 options:




  1. Get /_api/Web/Lists(guid'GUID')/Items, chose those with FileSystemObjectType eq 0 for files and FileSystemObjectType eq 1 for folders, and then arrange folders into tree using relative paths (e.g. for folder1="/A/B" and folder2="/A/B/C" assume that folder2 lays inside folder1)



    PS: filtering with neither /_api/Web/Lists(guid'GUID')/Items?$filter=FileSystemObjectType eq 0 nor /_api/Web/Lists(guid'GUID')/Items?$filter=FileSystemObjectType+eq+0 does not work for me




  2. Get /_api/Web/Lists(guid'GUID')/RootFolder and continue navigating with




/_api/Web/GetFolderByServerRelativeUrl(FOLDER_PATH)/Folders,

/_api/Web/GetFolderByServerRelativeUrl(FOLDER_PATH)/Files and

/_api/Web/GetFileByServerRelativeUrl(FOLDER_PATH)


Any other option?

Thank you








0 commentaires:

Enregistrer un commentaire