Skip to content

SharePoint Online: fetch Site Pages by URL to support non-English sites - #4926

Open
Jan-Kazlouski-elastic wants to merge 4 commits into
mainfrom
sdh-search-issue-2024
Open

Jan-Kazlouski-elastic wants to merge 4 commits into
mainfrom
sdh-search-issue-2024

Conversation

@Jan-Kazlouski-elastic

@Jan-Kazlouski-elastic Jan-Kazlouski-elastic commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes elastic/sdh-search#2024

Problem

Site pages were fetched via GetByTitle('Site Pages'). SharePoint localizes that library title (e.g. "Pages du site" on French sites), so the call returned 404, site_pages() swallowed it, and the sync succeeded with 0 pages.

Fix

  • Address the library by its language-independent URL: /_api/web/GetList('<web path>/SitePages') for page fetch and page role assignments.
  • For DLS inherited permissions (which use GetByTitle), resolve the real library title via GetList(...)?$select=Title (falls back to "Site Pages").
  • Log a warning when the library is not found instead of failing silently.
  • Updated the functional-test fixture route and added unit tests.

Notes

SharePoint Server: the Site Pages library is now detected by its /SitePages root folder URL instead of Title == "Site Pages" (permission lookups there already use the real list title).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new SharePoint missing-library warnings bypass the injected logger and lose sync-job context, so they and their tests need to use client._logger.

1 open issue
What changed in this PR

This PR makes SharePoint Site Pages discovery independent of localized library titles, preventing non-English sites from silently syncing zero pages.

Changes:

  • Fetch Online pages and page permissions by library URL, resolving the localized title for inherited permissions.
  • Detect Server page libraries by URL and warn when Online libraries are missing.
  • Update fixtures, add localization and URL-handling tests, and refresh two dependency notice versions.
File Description
app/​connectors_service/​tests/​sources/​test_sharepoint_server.py Tests URL-based library detection with localized titles.
app/​connectors_service/​tests/​sources/​test_sharepoint_online.py Tests URL escaping, title resolution, warnings, and inherited permissions.
app/​connectors_service/​tests/​sources/​fixtures/​sharepoint_online/​fixture.py Updates page routes and pagination links to use GetList.
app/​connectors_service/​NOTICE.txt Updates bracex and soupsieve version notices.
app/​connectors_service/​connectors/​sources/​sharepoint/​sharepoint_server/​datasource.py Identifies page libraries by their root folder URL.
app/​connectors_service/​connectors/​sources/​sharepoint/​sharepoint_online/​datasource.py Resolves the localized library title once for inherited permissions.
app/​connectors_service/​connectors/​sources/​sharepoint/​sharepoint_online/​client.py Adds URL-based library access, title escaping, and missing-library warnings.

Review effort: Balanced

)
return response.get("Title") or SITE_PAGES_LIST_NAME
except NotFound:
logger.warning(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants