Nucleus .Net Core CMS

SharePoint File System Provider

The SharePoint File System Provider extension allows Nucleus to connect to Microsoft SharePoint document libraries and access the files stored within them.

You can browse and manage SharePoint folders and files from within Nucleus, and use SharePoint as a storage location for files used by your website. This allows you to access files already stored in SharePoint without needing to maintain duplicate copies in your Nucleus file system.

In most cases, the SharePoint File System Provider will be used as a secondary file system provider, with one of the other file system providers used as your main file system provider. The SharePoint File System Provider can then be used to access files stored in SharePoint without maintaining duplicate copies in multiple locations. Nucleus can have multiple file system providers configured, and you can choose which provider to use when uploading files to your website.

Authentication

The SharePoint File System Provider uses the Microsoft Graph API to communicate with SharePoint. Authentication is performed using an application registration in Microsoft Entra ID. This allows Nucleus to access SharePoint without requiring an individual user's credentials.

Setup

Entra ID Setup

Navigate to the Microsoft Entra ID portal.

Create an App Registration

  • Click "App registrations" in the left-hand menu, then click "New registration".
    • Name: Choose a name to describe your application, like "SharePoint Access for your-site-name".
    • Supported Account Types: Choose "Accounts in this organizational directory only - Single tenant)".
    • Redirect URI: Not required, unless you are using the App Registration for other purposes.

App Registration: Certificates and Secrets

  • Click "Client Credentials" in the Overview page, or click "Certificates and Secrets" in the left-hand menu.
  • Choose whether you want to use a certificate or client secret and perform one of the following steps.
    • Option 1: Add a client secret. Note the expiry date and set a reminder for yourself, as you will need to issue a new secret and configure Nucleus to use it before the old one expires. You must copy and store the client secret immediately, as it can only be viewed immediately after creation.
    • Option 2: Add a certificate. Refer to Add a certificate to an app by using Microsoft Graph for more information. Your certificate will need to be saved in PFX format (as a file), or be installed in the Local Machine/Personal certificate store of your web server.

App Registration: API Permissions

  • Click "API Permissions" in the left-hand menu
  • Click "Add a permission". In the Add a permission pane, select Microsoft Graph (the first option). Select Microsoft Graph, not SharePoint. Although both options contain permissions with similar names, they apply to different APIs. Ensure you select the permissions under Microsoft Graph > Sites.
  • Click "Application Permissions" (do not click Delegated Permissions)
  • When prompted to select permissions, scroll down to "Sites". These permissions control access to SharePoint sites through the Microsoft Graph API.
  • Add Sites.ReadWrite.All. The Sites.ReadWrite.All application permission provides Nucleus with read and write access to all SharePoint site collections in your tenant.
  • Click "Grant admin consent for [your tenant name]"

App Registration: Collect information

  • Copy the "Directory (tenant) ID". This is the TenantId that you will use in Nucleus settings.
  • Copy the "Application (client) ID". This is the ClientId that you will use in Nucleus settings.
  • If you have chosen to use a client secret, you will have already recorded it when you created it.
  • If you have chosen to use a certificate, you will need to save the certificate from the certificate store as a PFX file in a location that your web server can access, or install it into your Local Machine/Personal certificate store. You will need the certificate thumbprint to configure Nucleus.

Nucleus Settings

If you are setting up a new instance of Nucleus, you can add the SharePoint File System Provider from the setup wizard. If you already have an instance of Nucleus, you will need to edit your appSettings.{environment}.json file.

In your appSettings.{environment}.json file, you will need to add an entry to the Nucleus:FileSystems:Providers section:

Refer to the Nucleus Configuration Reference for information on configuration files.

Nucleus:FileSystems:Providers

Option 1: Client Secret

{
	"Key": "my-company-sharepoint",
	"Name": "SharePoint",
	"ProviderType": "Nucleus.Extensions.SharePointFileSystemProvider.FileSystemProvider,Nucleus.Extensions.SharePointFileSystemProvider",
	"TenantId": "your-entra-tenant-id",
	"ClientId": "your-app-registration-id",
	"ClientSecret": "your-secret"
}

Option 2: Certificate PFX File

{
	"Key": "my-company-sharepoint",
	"Name": "SharePoint",
	"ProviderType": "Nucleus.Extensions.SharePointFileSystemProvider.FileSystemProvider,Nucleus.Extensions.SharePointFileSystemProvider",
	"TenantId": "your-entra-tenant-id",
	"ClientId": "your-app-registration-id",
	"CertificateFile": "C:\\path\\to\\your\\certificate.pfx"
}

Option 3: Certificate PFX File with Password

{
	"Key": "my-company-sharepoint",
	"Name": "SharePoint",
	"ProviderType": "Nucleus.Extensions.SharePointFileSystemProvider.FileSystemProvider,Nucleus.Extensions.SharePointFileSystemProvider",
	"TenantId": "your-entra-tenant-id",
	"ClientId": "your-app-registration-id",
	"CertificateFile": "C:\\path\\to\your\\certificate.pfx"
}

Option 4: Certificate from Windows Certificate Store

{
	"Key": "my-company-sharepoint",
	"Name": "SharePoint",
	"ProviderType": "Nucleus.Extensions.SharePointFileSystemProvider.FileSystemProvider,Nucleus.Extensions.SharePointFileSystemProvider",
	"TenantId": "your-entra-tenant-id",
	"ClientId": "your-app-registration-id",
	"CertificateIdentity": "your-certificate-thumbprint"
}

Setting Description
TenantId Your Microsoft Entra ID directory (tenant) ID. You can view this value in the App Registrations - Overview page in the Microsoft Entra ID portal.
ClientId The Application (client) ID for your App Registration. You can view this value in the App Registrations - Overview page.
One of:
- ClientSecret If you are using a client secret, this setting specifies the client secret from your App Registration.
- CertificateFile Loads a certificate from a PFX file. CertificateFile specifies the path and file name of your certificate file, which must be in PFX format.
- CertificateIdentity Specifies a certificate from your Windows certificate store. The certificate can be identified by thumbprint, serial number, subject key identifier or subject name of your certificate, which must be stored in the Local Machine/Personal certificate store.
CertificatePassword This option can be used with the CertificateFile option to specify a password, if your .pfx file is password-protected.

Limitations

Site Home Directory

The SharePoint File System Provider does not support the Site Home Directory property or the RootPath configuration setting.

SharePoint document libraries are identified internally by unique IDs rather than user-friendly paths, so the SharePoint provider cannot use the same home directory and root path conventions as other file system providers.

The download URL provided by the Microsoft Graph API is temporary and expires after a short period. Additionally, SharePoint responds with a Content-Disposition header that instructs browsers to download the file rather than display it inline.

Consequently, the SharePoint File System Provider cannot use these download URLs as permanent direct links to files stored in SharePoint.

Instead, the provider generates URLs that direct requests through the Nucleus File Controller. The controller retrieves the file from SharePoint and streams it to the browser.

This additional processing introduces overhead compared with serving files directly. For this reason, SharePoint should not be used to host frequently accessed resources such as website logos, CSS files or JavaScript files.