none
Webservice returns a null payload when queried at the ROOT of any library using the ListItemAllFields API RRS feed

  • Question

  • My developers are working on writing a Plugin that works with an OnPremise Sharepoint server and APIs

    Can someone help me point them in the right direction by answering the following query:

    Using REST Web services, we are able to access and set the metadata columns present within a particular folder. API used:

    "/_api/web/getfolderbyserverrelativeurl(<relative folder path>)/ListItemAllFields

    However, the above webservice returns a null payload when queried at the ROOT of any library. We are able to set the metadata using the same process at the ROOT of any library successfully.  Only the GET request is not returning the expected value.

    Any help with this would be greatly appreciated.



    • Edited by pc12345_ Wednesday, January 25, 2017 5:36 AM
    Wednesday, January 25, 2017 5:35 AM

Answers

  • Hi,

    ListItemAllFields: Gets a value that specifies the list item field values for the list item corresponding to the file.

    https://msdn.microsoft.com/en-us/library/office/dn450841.aspx

    If you want to get the root files properties, please use this:

    /_api/web/getfolderbyserverrelativeurl('/DocumentLibrary')/Files?$expand=ListItemAllFields

    If you want to get document root folder properties, we can use this:

    /_api/web/lists/getbytitle('DocumentLibrary')/rootfolder

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, January 26, 2017 3:58 AM
    Moderator
  • Hi Dennis,

    The APIs mentioned in the link provided didn’t work for us at fetching the metadata of the root folder.
    However, it did help us in finding another API to fetch metadata configured using root folder (excluding the relative folder).


    The API used to fetch metadata is: 
    https://{site Url}/_api/web/lists/getbytitle(‘Document Library’)/items(1)

    The URL is tested for SHAREPOINT 365.

    So we are good for this issue. We really appreciated the help and it definitely guided us to the right approach. 

    Thanks again!

    Best Regards,

    Pedro

    • Marked as answer by pc12345_ Tuesday, February 14, 2017 3:34 PM
    Tuesday, February 14, 2017 3:33 PM

All replies

  • Hi,

    ListItemAllFields: Gets a value that specifies the list item field values for the list item corresponding to the file.

    https://msdn.microsoft.com/en-us/library/office/dn450841.aspx

    If you want to get the root files properties, please use this:

    /_api/web/getfolderbyserverrelativeurl('/DocumentLibrary')/Files?$expand=ListItemAllFields

    If you want to get document root folder properties, we can use this:

    /_api/web/lists/getbytitle('DocumentLibrary')/rootfolder

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, January 26, 2017 3:58 AM
    Moderator
  • Hi Dennis,

    The APIs mentioned in the link provided didn’t work for us at fetching the metadata of the root folder.
    However, it did help us in finding another API to fetch metadata configured using root folder (excluding the relative folder).


    The API used to fetch metadata is: 
    https://{site Url}/_api/web/lists/getbytitle(‘Document Library’)/items(1)

    The URL is tested for SHAREPOINT 365.

    So we are good for this issue. We really appreciated the help and it definitely guided us to the right approach. 

    Thanks again!

    Best Regards,

    Pedro

    • Marked as answer by pc12345_ Tuesday, February 14, 2017 3:34 PM
    Tuesday, February 14, 2017 3:33 PM