SharePoint Integration from Organization root url with Mendix

0
Hi Everyone,I need to integrate to my Organizations SharePoint from Mendix application, so the root url could be "https://xxxxxx.sharepoint.com" or "https://xxxxxx.sharepoint.com/sites". Need to access all the files under this navigation. As "https://xxxxxx.sharepoint.com" or "https://xxxxxx.sharepoint.com/sites" is not a folder, can I access all the folders from this higher hierarchical url. From basic investigation I could understand from a folder we could integrate and the mentioned ones are basic and not the folders. Please do let me know if its feasible and the approach(if it`s feasible), as I dont want to miss any folder from the above mentioned hierarchy. Regards,Cyril Santhosh K
asked
1 answers
0

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/.default

Store 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}/drives

This 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/children

For each item containing a folder facet, recursively retrieve its children:

GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/children

Continue 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 Metadata

I 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:

Hope this helps! If you find this answer helpful, please mark it as the accepted answer.

answered