3

I have a list that has a lookup field on a documents library. I can get and expand fields no problem only if they are single line of text fields (FieldTypeKind = 2). But when I have a multiple lines of text field (FieldTypeKind = 3), then it doesn't work.

For example, I have the field with name: props. The following works if it is single line of text:

/_api/web/lists/getbytitle('My List')/Items('19')?$select=*,files/Id,files/props&$expand=files

But I need props to be a multiple lines of text (more than 255 chars), when I set it to that then I get the following error

The query to field 'files/props' is not valid.

The internal name is correct (props). If I change the field props back to single line of text field there is no error.

How can I expand a multiple lines of text field with the REST API?

1 Answer 1

4

I now see from the answer to this question:

REST API Getting Fields from an Lookup List

that it looks like multi line text fields are not a supported type for lookup fields, which seems ridiculous to me.

The only solution that I could find was using the Sharepoint 2010 REST API. With that I can do something like:

/_vti_bin/listdata.svc/MyList(19)?$select=*,Files/Title,Files/Props,Files/View_link&$expand=Files

Then it will work for the multiline text fields. But of course this isn't straightforward either (it's Microsoft, why would it be?). With this API they mess with the column names so that you can't use the internal names.

So even though my internal field name in Sharepoint is "files", this API needs it to be referenced by "Files". Likewise with the column internal name of: "props", it needs to be referenced by "Props". And the list name if it was "My List" would need to be changed to "MyList"

Developing for Sharepoint is really a horrible, unpredictable experience. It takes so much time to decipher even very simple things. And so often Micrsoft leaves you with "solutions" that just feel dirty, and unreliable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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