Pnpjs: Multiple Lines of Text Field / Lookup

Created on 2 Aug 2018  路  4Comments  路  Source: pnp/pnpjs

Category

  • [X] Enhancement
  • [ ] Bug
  • [X] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [ 1.5.1]

Hello,

first of all, thanks for the amazing framework!

We're trying to resolve a SharePoint Lookup where the Column within the Lookup List is a "Multiple lines of Text" Field.

Example Code:
web.lists.getByTitle("MyList").items.select("MyLookupColumn/MyColumnInTheLookupList").expand("MyLookupColumn").get().then(items聽=>聽{ //ERROR });

If we try to do so we get the following error Message: "The query to field 'MyColumnInTheLookupList' is not valid."

After some research (for Example: SharePoint Stackexchange) we found out that multiple lines of text lookup fields are not supported within the REST API, instead you have to use the old "SharePoint 2010" ListData Service.

It would be really helpful if you could implement a fallback to the listdata.svc when trying to resolve multiple lines of text lookup fields.

Cheers
Patrick

code answered question

Most helpful comment

Thanks for the quick response!

I close the issue, we will create the method using the SPHttpClient.

All 4 comments

Hi @patrick-mittendorfer,

As mentioned, lookups expand supports only a simple type of field types, the same exaclty limitation as with "dependent lookups" setting in the list.

I'm not sure that wrapping legacy listdata.svc endpoint as a fallback or alternative correlates with the library, yet there is an option to call any custom endpoint using SPHttpClient.

This isn't something we can really add into the library as a "fallback". I am not sure how we would implement the logic "if X query involves Y special case then run a different code path" and it seems like it would grow to be unmanageable. I think the best thing would be to do as Andrew suggested and just create the method you need using the SPHttpClient directly. Something like:

import { sp, SPHttpClient } from "@pnp/sp";
import { ODataDefaultParser } from "@pnp/odata";

const client = new SPHttpClient();
const result = await client.get("https://{site}/_vti_bin/listdata.svc/MyList(19)?$select=*,Files/Title,Files/Props,Files/View_link&$expand=Files");

const parser = new ODataDefaultParser();
const parsedResult = await parser.parse(result);

Thanks for the quick response!

I close the issue, we will create the method using the SPHttpClient.

Great, do let us know if you have further questions!

Was this page helpful?
0 / 5 - 0 ratings