Fix InitPath procedure to extract and prepend SharePoint site path to…#6241
Merged
JesperSchulz merged 1 commit intomicrosoft:mainfrom Jan 22, 2026
Merged
Conversation
.../External File Storage - SharePoint Connector/App/src/ExtSharePointConnectorImpl.Codeunit.al
Show resolved
Hide resolved
haoranpb
approved these changes
Jan 21, 2026
.../External File Storage - SharePoint Connector/App/src/ExtSharePointConnectorImpl.Codeunit.al
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes a critical bug in the SharePoint connector where file downloads were failing with 400 Bad Request errors because paths sent to SharePoint's REST API were incomplete. The issue occurred because the connector was not extracting and prepending the SharePoint site path (e.g., "/sites/mysite") from the SharePoint URL to file paths, resulting in incorrect server-relative URLs.
Changes:
- Modified the
InitPathprocedure to extract the site path from the SharePoint URL and prepend it to file paths - Added a new
GetSitePathFromUrlhelper method to extract the site path using the Uri codeunit - Updated path construction logic to ensure proper server-relative URLs are sent to SharePoint's REST API
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JesperSchulz
approved these changes
Jan 21, 2026
Contributor
|
Backported for release with 27.4. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… file paths
Summary
The Problem:
The SharePoint connector was failing with a 400 Bad Request error when trying to download files because the paths being sent to SharePoint's REST API were incomplete.
Root Cause:
SharePoint REST API requires server-relative URLs that include the full site path.
For example:
Wrong: /Shared Documents/TEST/Design.png
Correct: /sites/mysite/Shared Documents/TEST/Design.png
The original implementation only combined the base folder path with the file path, but didn't extract and prepend the site path from the SharePoint URL.
Work Item(s)
Fixes #3872
Fixes AB#619102