Forum Discussion
Mike Jansen
Mar 21, 2017Iron Contributor
Rest api search query --- Lookup field issue
I have a document library which has a custom field "Label" this Label field is a lookup field (to a list) multiple values allowed. For example my documentlibrary: Title Label doc1 ...
- Mar 22, 2017Haven't tested it, but it should work with the $filter:
/_api/web/lists/GetByTitle('Documents')/items?$select=*,Label/Title&$expand=Label&$filter=Label/Title eq 'labelX'
Let us know how it goes.
Brent Ellis
Mar 21, 2017Silver Contributor
Mike, don't have a ready of example of this, but you may have to "expand" it to get the Label text. By default, all you see is the ID.
For example, getting "more" fields for a user field is done like this:
<site>/_api/web/Lists(guid'<LIST ID>')/Items?$expand=PERSONFIELD&$select=*,PERSONFIELD/EMail
For example, getting "more" fields for a user field is done like this:
<site>/_api/web/Lists(guid'<LIST ID>')/Items?$expand=PERSONFIELD&$select=*,PERSONFIELD/EMail
Mike Jansen
Mar 21, 2017Iron Contributor
Hi Brent Ellis
Great!! This works:
https://blabla.sharepoint.com/sites/mike/label/_api/web/lists/getByTitle('Documents')/items?$expand=Label&$select=*,Label/TitleBut now I need to get it to the next level. I want to filter on "LabelX"
Something like this:
https://blabla.sharepoint.com/sites/mike/label/_api/web/lists/getByTitle('Documents')/items?$expand=Label&$select=*,Label/Title&refinementfilters='Label/Title eq ('labelX')
Any suggestions?