Hi Cyril,
Yes, this is feasible. You can integrate Mendix with your organization's SharePoint tenant and discover sites, document libraries, folders, and files without hardcoding individual site URLs.
I recommend using Microsoft Graph API for this requirement.
1. Configure Microsoft Entra ID authentication
Register an application in Microsoft Entra ID and configure:
Microsoft Graph application permission: Sites.Read.All
Admin consent for the permission
OAuth 2.0 client credentials flow for server-to-server integration
Use the following token scope:
https://graph.microsoft.com/.defaultStore the application credentials securely.
2. Discover SharePoint sites
To discover sites across your organization, call:
GET https://graph.microsoft.com/v1.0/sites/getAllSites
Authorization: Bearer {access_token}This endpoint supports tenant-wide site discovery, including multi-geo tenants.
It requires application permissions; delegated authentication is not supported for this endpoint.
3. Retrieve document libraries for each site
For each returned site ID, call:
GET https://graph.microsoft.com/v1.0/sites/{site-id}/drivesThis returns the site's available document libraries.
4. Retrieve folders and files recursively
For each drive, retrieve the root items:
GET https://graph.microsoft.com/v1.0/drives/{drive-id}/root/childrenFor each item containing a folder facet, recursively retrieve its children:
GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/childrenContinue until the required folder hierarchy has been retrieved.
5. Implement the integration in Mendix
Create REST activities and JSON import mappings for the Graph API responses.
A suitable microflow structure would be:
ACT_SyncSharePoint
|
v
Get Microsoft Graph Access Token
|
v
Get All SharePoint Sites
|
v
Loop Through Sites
|
v
Get Document Libraries
|
v
Loop Through Drives
|
v
Get Root Folder Items
|
v
Recursively Retrieve Child Folders
|
v
Store Site / Drive / Folder / File MetadataI recommend storing the Graph IDs and parent-child relationships in Mendix rather than relying only on SharePoint URLs.
Important considerations:
Handle @odata.nextLink for pagination at every collection level.
Implement retry handling for Microsoft Graph throttling (429), respecting the Retry-After header.
Avoid recursive microflows that retrieve the entire tenant in one synchronous request. Use background processing or task queues for large organizations.
Access is limited to the sites and content permitted by the granted application permissions.
If you also need SharePoint lists rather than document libraries alone, use GET /sites/{site-id}/lists.
Conclusion:
You do not need to hardcode each SharePoint site URL. Use Microsoft Graph to discover the sites first, then enumerate their document libraries and folders recursively.
Official Microsoft documentation:
https://learn.microsoft.com/en-us/graph/api/site-getallsites?view=graph-rest-1.0
https://learn.microsoft.com/en-us/graph/api/drive-list?view=graph-rest-1.0
https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0
Hope this helps! If you find this answer helpful, please mark it as the accepted answer.