4

I am trying to query a list with lookup column to another list, basically I have sub announcements, and announcements, I want to get all sub announcements of particular announcement, so my query looks like this:

https://domainname.sharepoint.com/sites/hr/_api/web/lists/getByTitle('Sub Announcements')/items?$select=Title,Announcements/Title&$expand=Announcements/Title&$filter=(Announcements/Title eq 'Parent Announcement1')

but am getting the error:

The field or property 'Announcements' does not exist.

Also what if the parent list has space in the name, in the expand do we put the name with spaces? for example do we put $expand= List name with space/Title ?

Thanks for the clarification.

  • 1) How are you retrieving "domainname.sharepoint.com/sites/hr". 2) where is your announcements list, in your HR siteor App? 3) where are you running this script from app or somewhere else – Gaurravs Dec 19 '15 at 10:07
  • What is the internal name of Announcements? You have to use internal name – Atish Dipongkor - MVP Dec 19 '15 at 12:08
5

It seems you are using list name in the $select, $expand and $filter.

But you need to use the internal name of your lookup column.

For example, lookup column name is XXXLookup,

In $select it should be $select=XXXLookup/ID,XXXLookup/Title.

In $expand, it should be $expand=XXXLookup

In $filter, it should be $filter=XXXLookup/ID eq 1.

Find more in my codeproject article.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.