none
Get Folder Metadata using REST api RRS feed

  • Question

  • I have a library having below content types:

    • Document
    • CustomFolder , inherited from Folder Content Type containing User Type Field called SPOC

    Now, i want to get Email of user added in SPOC  at folder level and i do not want to query every folder 1  by 1. i am using below query 

    https://server/sites/siteColl/site/_api/web/lists/getByTitle('OTHERS')/items?$expand=Folder/CustomFolder,Folder/CustomFolder/SPOC/ID

    i gives me only SPOCID.

    If i add $select Folder/CustomFolder/SPOC/EMail in above query, then i does not return SPOC field at all.

    I am able to do that for all files using below query

    https://server/sites/siteColl/site/_api/web/lists/getByTitle('OTHERS')/items?select=DocumentOwner/EMail&$expand=File,DocumentOwner/Id  

    where Document Owner is a User type field but added directly in Library rather than content type.

    So what approach to follow if we want folder metadata as specified above.


    -Manjot

    Tuesday, March 14, 2017 5:28 AM

Answers

  • Hi Manjot,

    Since this SPOC field only exist in your custom folder content type, for items with other content types, the value of this field will be “null”, thus, we can send the request like this:

    "/_api/web/lists/getbytitle('library')/items?$select=SPOC/EMail&$expand=SPOC/EMail"

    The response will be like this:

    In my library, there are four items, two are folders and two are documents, we can see that, the “EMail” property only exist in the two folders.

    Please let me know if this is what you request.

    Best regards,

    Patrick

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


    Wednesday, March 15, 2017 1:43 PM
    Moderator

All replies

  • Hi Manjot,

    Since this SPOC field only exist in your custom folder content type, for items with other content types, the value of this field will be “null”, thus, we can send the request like this:

    "/_api/web/lists/getbytitle('library')/items?$select=SPOC/EMail&$expand=SPOC/EMail"

    The response will be like this:

    In my library, there are four items, two are folders and two are documents, we can see that, the “EMail” property only exist in the two folders.

    Please let me know if this is what you request.

    Best regards,

    Patrick

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


    Wednesday, March 15, 2017 1:43 PM
    Moderator
  • Thanks a lot Patrick .. Its working now :)

    -Manjot

    Saturday, March 18, 2017 3:39 PM