[28.x] Add Microsoft Graph API Support to SharePoint Connector#9561
Open
JesperSchulz wants to merge 2 commits into
Open
[28.x] Add Microsoft Graph API Support to SharePoint Connector#9561JesperSchulz wants to merge 2 commits into
JesperSchulz wants to merge 2 commits into
Conversation
<!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> Implements [Idea Business Central limits the maximum HTTP response content size to 150 MB by default (controlled by the `NavHttpClientMaxResponseContentSize` server setting). This limitation causes file downloads from SharePoint to fail for files larger than this threshold. While chunked downloads would solve this issue, SharePoint REST APIs do not support chunked downloads (only uploads). Microsoft Graph API, however, does support this capability. This PR introduces Microsoft Graph API support as an alternative implementation alongside the existing SharePoint REST API, with a backward-compatible toggle to switch between the two. - **New field**: Added "Use Graph API" toggle in `ExtSharePointAccount.Table.al` and `ExtSharePointAccount.Page.al` to control API selection - **Improved UX**: Updated tooltips to clarify folder path requirements for both APIs - **Refactored implementation**: Modified `ExtSharePointConnectorImpl.Codeunit.al` to route operations based on API selection - **New codeunits**: - `ExtSharePointGraphHelper.Codeunit.al`: Encapsulates Graph API operations for files and directories - `ExtSharePointRestHelper.Codeunit.al`: Encapsulates existing REST API operations - **Bug fix**: Fixed certificate parameter assignment in `GraphAuthClientCredentials.Codeunit.al` that prevented certificate-based authentication from working correctly Depends on SharePoint module additions in the System Application (see - **Removes file size limitations**: Graph API supports downloading files larger than 150 MB through chunked downloads - **Flexibility**: Users can choose the API that best fits their requirements - **Clean permissions model**: App registration can use either SharePoint REST or Graph API permissions without mixing - **Backward compatible**: Existing implementations continue to work without changes - Account table — secret storage round-trips, auth methods are mutually exclusive (setting one clears the other's keys), new accounts default to Graph. - Upgrade — existing accounts get Use legacy REST API = true, so nobody silently switches API stacks on upgrade. - Graph helper — HTTP-level tests via [HttpClientHandler]: listing filters files vs folders, base-path composition (incl. trailing-slash edge), downloaded content survives the stream hand-over, ≤4 MB uses simple upload vs >4 MB creates an upload session + chunks, copy uses native /copy, move uses PATCH, exists-check returns false on 404 but errors on 500, correct verbs for delete/create, disabled account fails before any HTTP. - REST helper — same operation set for the legacy stack, asserting the actual requests sent (download/upload/delete legs). Notably: copy must not delete the source, move must — the delete leg is the only difference between them. - Dispatch — calls go through Ext. SharePoint Connector Impl and assert the Use legacy REST API flag routes to exactly one API family (graph.microsoft.com vs /_api/). Sampled on 3 of the 11 operations since the dispatch code is uniform. needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes #5383 Fixes [AB#612932](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/612932) --------- Co-authored-by: Tine Staric <tine.staric@companial.com> Co-authored-by: Bert Verbeek <bverbeek@4ps.nl> Co-authored-by: Jesper Schulz-Wedde <JesperSchulz@users.noreply.github.com> Co-authored-by: Jesper Schulz-Wedde <jeschulz@microsoft.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> (cherry picked from commit 30b880e)
Contributor
|
Issue #5383 is not valid. Please make sure you link an issue that exists, is open and is approved. |
The 28.x CodeCop ruleset flags variables of TableType=Temporary tables that are prefixed with Temp (AA0237), whereas main requires the prefix. Rename TempSharePointFile/TempSharePointFolder/TempGraphDriveItem to match the 28.x convention so the SharePoint Connector app compiles. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: fb130121-74a3-45cb-9907-c89e38e78f16
pull Bot
pushed a commit
to Mattlk13/BCApps
that referenced
this pull request
Jul 17, 2026
## Symptom The team-ownership classification workflow (`.github/workflows/ownership-classification.yml`) in microsoft/BCApps rejects correct classifications as malformed, failing with: > The ownership result from BCAppsTriage was malformed, so no labels were changed. This broke a real PR: microsoft/BCApps microsoft#9561 (base `releases/28.x`, linked issue microsoft#5383) was correctly classified as team `Integration` with `source: pull_request:linked-issue`, but the workflow threw the malformed error and applied no labels. ## Root cause The `Validate and apply ownership result` step validates `result.ownership.source` against a hardcoded `sources` allowlist. A merged BCAppsTriage change (PR #40, linked-issue PR routing) added a new emitted source value `pull_request:linked-issue` — a PR whose team is adopted from its linked issue when the changed files are ambiguous. The BCApps allowlist was never updated, so any such result is rejected as malformed. ## Fix Add `'pull_request:linked-issue'` to the `sources` allowlist, immediately after `'pull_request:incomplete-files'`. This restores parity with the classifier's `decision.js` source set in BCAppsTriage — the only emitted source value missing from the allowlist. The allowlist now contains all 12 valid source values. Single-line change; no other edits. Fixes [AB#642506](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/642506) --------- Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
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.
Backport
Backports #5833 to the
releases/28.xbranch.Cherry-picked the squash merge commit
30b880e0ontoreleases/28.x. One conflict inExtSharePointConnectorImpl.Codeunit.alwas resolved by taking the PR's dispatch-based implementation — the only divergence on 28.x was a cosmeticTempSharePointFile→SharePointFilevariable rename in method bodies that the PR deletes entirely.Original summary
Adds Microsoft Graph API support as an alternative to the existing SharePoint REST API, with a backward-compatible
Use legacy REST APItoggle. Graph API supports downloading files larger than 150 MB via chunked transfers, which the SharePoint REST API cannot.Use legacy REST APIonExt. SharePoint Accounttable/page to select the API stackExt. SharePoint Connector Implto dispatch operations to REST vs Graph based on the flagExt. SharePoint Graph Helper,Ext. SharePoint REST Helper,Ext. SharePoint Upgrade(existing accounts default to legacy REST on upgrade so nobody silently switches stacks)idRangesto 4610Backport verification
SharePoint Graph Clientmethods called by the helper exist with matching signatures.SetParametersfix referenced by the original PR is already present on 28.x'sGraphAuthClientCredentials(it was not part of the squash diff).Fixes #5383
Fixes AB#612932