0

Actually I am new to SharePoint Rest API stuff, I appologize in advance if my query is silly.

I have list which have columns of different types. I am suppose to make ajax call to this list and fetch some data.

The data which I need is in Lookup column type.

Name of this column is 'Client', after fetching data, in result I am seeing column name 'ClientId' present and actual column 'Client' is missing. I am not sure from where this 'ClientId' is coming from.

I tried following query:

/sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=Client

I am getting this error:

The query to field 'Client' is not valid.

But when I am changing my query to:

/sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=ClientId

I am getting data, I am not sure how but yet I am able to get data but only Item ID not title.

<m:properties>
  <d:ClientId m:type="Collection(Edm.Int32)">
    <d:element>230</d:element>
  </d:ClientId>
</m:properties>

I tried 'expand', but that also couldn't help me.

Code with 'expand'

/sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=Client&$expand=Client

I tried this too:

/sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=Client/Title&$expand=Client
/sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=ClientId/Title&$expand=ClientId

I really appreciate if someone give me some tip of what wrong I am doing.

  • 2
    /sites/MySite/_api/web/lists/getbytitle('MyList')/items?$select=Client/Title&$expand=Client :--> This URL that you have already specified should give you Title from the lookup field. Seems to be no issue with this with this URL. – Rohit Waghela Oct 20 '16 at 5:14
  • what's the error for /_api/web/lists/getbytitle('MyList')/items?$select=Client/Title&$expand=Client? – Atish Dipongkor - MVP Oct 20 '16 at 5:52

Your Answer

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

Browse other questions tagged or ask your own question.