Collab365 Q&A

0

Hail REST API Guru. I’m having trouble bringing back data from a lookup field. I have a field pointing to a MeetingDate list for a field called StatusedDate
I’ve tried ever combination of API but I can get the field StatusedDateId but not the StatusedDate.
I can see the StatusedDateId in the source but can’t quite get the expand command to work.

Here are some combinations I’ve tried:

/_api/web/lists/getbytitle(‘Facility%20Status%20List’)/items?$select=StatusedDateId/StatusedDate&$expand=StatusedDateId/StatusedDate
/_api/web/lists/getbytitle(‘Facility%20Status%20List’)/items?$select=StatusedDateId/StatusedDate&$expand=StatusedDateId, StatusedDateId/StatusedDate
/_api/web/lists/getbytitle(‘Facility%20Status%20List’)/items?$select=StatusedDateId,StatusedDateId/StatusedDate&$expand=StatusedDateId

1

Hi there Looks like you are trying to pull StatusedDateId which, internally is the ID field of the lookup column. You want to try and pull the field name followed by the properties you want.

For example. Lets say your lookup is called ‘StatusedDate’. And it has two fields on it, Id and ‘StatusedDate’ (these are the names of the two columns on that list).

Your query would be as follows…

/_api/web/lists/getbytitle(‘FacilityStatusList’)/items?$select=StatusedDate/Id,StatusedDate/StatusedDate&$expand=StatusedDate

Notice the lack of ‘id’ (unless your lookup field is actually called ‘StatusDateId’

0

First Thank-you for looking at this.

This is the URL I constructed from your comments:

/_api/web/lists/getbytitle(‘FacilityStatusList’)/items?$select=StatusedDate/Id,StatusedDate/StatusedDate&$expand=StatusedDate
<m:error xmlns:m=”http://schemas.microsoft.com/ado/2007/08/dataservices/metadata debug=”true>

<script id=”FirebugLite firebugIgnore=”true extension=”Chrome/>
<m:code>-1, Microsoft.SharePoint.SPException</m:code>

<m:message xml:lang=”en-US>
The query to field ‘StatusedDate/StatusedDate’ is not valid.
</m:message>

</m:error>

#################################
This is a partial dump of my xml getting items:
-<content type=”application/xml”>

-<m:properties>

<d:FileSystemObjectType m:type=”Edm.Int32″>0</d:FileSystemObjectType>

<d:Id m:type=”Edm.Int32″>2</d:Id>

<d:ContentTypeId>0x0100C9ACADE1287A174398086721C94B52D5</d:ContentTypeId>

<d:Title m:null=”true”/>

<d:ItemCategory>Accomplishments</d:ItemCategory>

<d:Detail><div class=”ExternalClass94D9428E189B416995DB454BB1620308″><p><span style=”font-size:9pt;”><span style=”color:black;font-family:&quot;times new roman&quot;;”><span aria-hidden=”true”></span>​<span style=”color:black;font-family:&quot;times new roman&quot;;font-size:16pt;”><span style=”font-size:9pt;”>OCO3 successfully completed S-band commanding and received GSE data.</span><span style=”font-size:9pt;”>   </span><span style=”font-size:9pt;”>CSI is scheduling time to gather evaluation feedback.</span><span>    <span aria-hidden=”true”></span></span></span><span aria-hidden=”true”></span></span></span></p></div></d:Detail>

<d:Category>Flight</d:Category>

<d:StatusedDateId m:type=”Edm.Int32″>10</d:StatusedDateId>

<d:Expires m:null=”true”/>

<d:OutageDate m:null=”true”/>

<d:ServicesImpacted m:null=”true”/>

<d:Item m:null=”true”/>

<d:ID m:type=”Edm.Int32″>2</d:ID>

<d:Modified m:type=”Edm.DateTime”>2017-03-13T19:51:03Z</d:Modified>

<d:Created m:type=”Edm.DateTime”>2017-03-13T19:51:03Z</d:Created>

<d:AuthorId m:type=”Edm.Int32″>191</d:AuthorId>

<d:EditorId m:type=”Edm.Int32″>191</d:EditorId>

<d:OData__UIVersionString>1.0</d:OData__UIVersionString>

<d:Attachments m:type=”Edm.Boolean”>false</d:Attachments>

<d:GUID m:type=”Edm.Guid”>4039484b-d65a-4057-867f-9221ff1859c7</d:GUID>

</m:properties>

</content>

(0)