SharePoint GetFolderByServerRelativeUrl /Files API not returning list of files as expected -
i'm new sharepoint , i'm having trouble few of simple examples i've found , i'm not sure if there's permission don't have correct or if i'm not understanding properly.
when use browser access url:
https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos')
part of return xml says there 87 items <d:itemcount m:type="edm.int32">87</d:itemcount>
, correctly correlate number of files inside folder.
here's confused. when use following show contents of folder, don't of file information listed in result xml expect:
https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos')/files
i've tried following specific file info, file not found message:
https://mysite.com/_api/web/getfolderbyserverrelativeurl('/scf/shared%20documents/fy%202014%20memos/096.pdf')
am missing simple?
this behavior occurs since incorrect context of web sp.web.getfolderbyserverrelativeurl method specified in rest query:
https://[server]/[web]/_api/web/getfolderbyserverrelativeurl('/[web]/[library]/[folder]') | web site folder/files retrieved
assume following site structure:
/ news web (root) | archive sub web | documents library | 2008 folder
then following rest query:
https://[server]/archive/_api/web/getfolderbyserverrelativeurl('/archive/documents/2008')/files
or
https://[server]/archive/_api/web/getfolderbyserverrelativeurl('documents/2008')/files
will return files located in 2008
folder of documents
library under archive
sub site.
Comments
Post a Comment