SharePoint / SharePoint/sp-dev-docs

Inconsistent File Viewing/Rendering via auto-library reload (RenderListDataAsStream)

Open
#9,930 4 comments 0 reactions 1 assignee View on GitHub

@Ashlesha-MSFT is already working on this.

Since Apr 22, 2025.

Needs: Triage :mag: sharepoint-developer-support type:bug-confirmed 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?

other (enter in the "Additional environment details" area below)

Developer environment

None

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 Chrome 128.0.6613.138
  • SharePoint Modern Experience
Describe the bug / error

We are using the Graph API / CSOM to effectively replace an existing file with a stub/link file.

This uses the following Graph API endpoints:

  • Renames "Filename.docx" to "Filename.docx.url"
    PATCH /drives/{drive-id}/items/{item-id} (docs)

  • Replaces the file content with the URL Shortcut contents
    PUT /drives/{drive-id}/items/{item-id}/content (docs)

  • Deletes all previous version history via CSOM ListItem.Versions.DeleteAll()

We observe that the Document Library does a reload of the contents and shows the updated file.

However, clicking to view the file behaves differently until the full browser page is refreshed.

For example, the URL file is treated as a file download by the browser. After a page refresh, clicking the URL file will correctly navigate to the URL within the file (desired behaviour).

Url

The same can be seen for a 'txt' file. It is passed off to be rendered by the browser (e.g. displayed in a new tab). After a page refresh, clicking the 'txt' file results in it opening within the SharePoint Text viewer/editor.

Txt

Steps to reproduce
  1. Add an Office document to a library
  2. Call the Graph API to rename the file to a different format i.e. {Filename}.url
  3. Call the Graph API to replace the file contents i.e. the .url content
  4. Wait for the Document Library to reload automatically
  5. Click the file and observe the rendering is handled by the browser
  6. Refresh the page and click the file
  7. Observe the rendering is handled by SharePoint (desired) e.g. the URL shortcut is followed, or the txt file opens within the editor dialog.
Expected behavior

Ideally the behaviour would be consistent, and handled by SharePoint rendering.

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.