none
REST API Getting Fields from an Lookup List RRS feed

  • Question

  • I have a REST query that looks like this

    /_api/lists/getbytitle('MainList')/items?$select=Title,LookupField/Id,LookupField/Title&$expand=LookupField

    That works fine. But when I try to pull another field from the lookup list, I get an error. This query:

    /_api/lists/getbytitle('MainList')/items?$select=Title,LookupField/Id,LookupField/Title,LookupField/CustomField&$expand=LookupField

    Results in:

    The query to field 'LookupField/CustomField' is not valid.

    I should point out that if I try to pull in a standard field such as LookupField/Modified or LookupField/Created it works fine. It's only when I try to select a custom field that I get this error. Is that a limitation of the SharePoint API? Thanks!


    Jeremy Leff


    Thursday, December 22, 2016 3:27 PM

All replies

  • Hi Jeremy,

    What is the field type, of that CustomField?

    Thursday, December 22, 2016 4:06 PM
  • Hi,

    I use a single of text column to tested it, it works.

    I create a custom list "ListC" and add a new field "CustomField"(single of text), then create a new custom list "MainList" and add a lookup column "LookupField" to lookup "ListC".

    Then use the URI below to test in my IE browser, and I can get the value.

    /_api/lists/getbytitle('MainList')/items?$select=Title,LookupField/Id,LookupField/Title,LookupField/CustomField&$expand=LookupField

    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

    Friday, December 23, 2016 8:05 AM
    Moderator
  • Hi Jeremy,

    Any update?

    Do you check steps in my post above?

    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

    Tuesday, December 27, 2016 7:46 AM
    Moderator