SharePoint / SharePoint/sp-dev-docs

Lookup Fields Missing in Results When Using renderListDataAsStream with CAML Query

Open
#10,134 4 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Needs: Author Feedback sharepoint-developer-support type:bug-suspected
Dominant language
PowerShell
Stars
1.4k
Forks
1.1k
Avg merge
4d 12h
Merged PRs (30d)
12

Description

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

Windows

What browser(s) / client(s) have you tested
  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)
Additional environment details
  • browser version
  • SPFx version
  • Node.js version
  • etc
Describe the bug / error

I'm encountering an issue since 5 days when querying a SharePoint calendar list via the REST API using the PnP JS library's renderListDataAsStream method. Even though I've included the lookup field explicitly in the section of my CAML query and verified that the internal name is correct, the lookup field is not returned in the response.

Steps to reproduce

Setup:

  • Use a calendar list with recurring events.
  • Ensure the list contains at least one lookup field (e.g., "Employee") linked to another list.

Execute the Query:

Construct a CAML query with OverrideViewXml that includes:
  • A section explicitly listing the lookup field.
  • A section filtering recurring events using and a with a dynamically generated date.
  • with and set.
Set the Paging parameter to "Paged=TRUE".

Example CAML Query:

<View>
  <ViewFields>
    <FieldRef Name="Title" />
    <FieldRef Name="LookupFieldInternalName" />
  </ViewFields>
  <Query>
    <Where>
      <DateRangesOverlap>
        <FieldRef Name='EventDate' />
        <FieldRef Name='EndDate' />
        <FieldRef Name='RecurrenceID' />
        <Value Type='DateTime' IncludeTimeValue='TRUE'>
          ${dateValue.toISOString()}
        </Value>
      </DateRangesOverlap>
    </Where>
  </Query>
  <RowLimit>2000</RowLimit>
  <QueryOptions>
    <ExpandRecurrence>TRUE</ExpandRecurrence>
    <CalendarDate>${dateValue.toISOString()}</CalendarDate>
  </QueryOptions>
</View>
Observation:

The query successfully returns recurring event items.
However, the lookup field (Employee) is consistently missing from the returned data, even though it's defined in the .

Expected behavior

The lookup field should be included in the results alongside other fields (e.g., Title).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.