wagtail-sharepoint provides a StreamField block choosers for SharePoint documents and choosers, allowing search
and selection of items across one or multiple SharePoint instances.
In your project's Django settings, add the app your INSTALLED_APPS list (at the end is fine):
INSTALLED_APPS = [
# ...
"wagtail_sharepoint",
]Add the SharepointDocumentChooserBlock or SharepointPageChooserBlock block to your StreamField definition.
For example:
# yourapp/models.py
from wagtail.fields import StreamField
from wagtail.models import Page
from wagtail_sharepoint.blocks import (
SharepointDocumentChooserBlock,
SharepointPageChooserBlock,
)
class WonderfulPage(Page):
body = StreamField(
[
# ...
("sharepoint_document", SharepointDocumentChooserBlock()),
("sharepoint_page", SharepointPageChooserBlock()),
]
)Finally, run Django's makemigrations and migrate commands to apply any model field changes to your project
$ python manage.py makemigrations
$ python manage.py migrateTo start with, you will need to configure an Entra application, to get a tenant id, client id and secret.
Permission scopes: Sites.Read.All, Sites.ReadWrite.All
Add or update the WAGTAIL_SHAREPOINT configuration dictionary in your project's settings file.
The configuration dictionary has the following options:
WAGTAIL_SHAREPOINT = {
"TENANT_ID": "<Entra tenant id>",
"CLIENT_ID": "<Entra client id>",
"CLIENT_SECRET": "<Entra client secret>",
"SITE_ID": "<instance id>", # Either the Sharepoint instance id
# OR
"SITE_IDS": ["<instance_1_id>", "instance_2_id"], # or a list of instance IDs
"REGION": "<region here>", # Optional. Defaults to "GBR"
# for local development and debug. Works in conjunction with DEBUG=True
"DISABLE_CACHE": False, # Optional. Defaults to False.
}A SharePoint site is identified by a unique ID that is a composite of the following values:
- Site collection hostname (e.g.
contoso.sharepoint.com) - Site collection unique ID (GUID. e.g.
f2f28bab-9c17-411d-bb28-2914b4957958) - Site unique ID (GUID. e.g.
aac37637-022b-45e3-9d25-59f7aa14d640)
You can use the full ID (contoso.sharepoint.com,f2f28bab-9c17-411d-bb28-2914b4957958,aac37637-022b-45e3-9d25-59f7aa14d640),
the site collection id (f2f28bab-9c17-411d-bb28-2914b4957958) or the site unique id (aac37637-022b-45e3-9d25-59f7aa14d640).
All contributions are welcome! See CONTRIBUTING.md
Supported versions:
- Python 3.12, 3.13, 3.14, 3.15
- Django 5.2, 6.0, 6.1
- Wagtail 7.4 (LTS), 8.0