⚠️ Classic page types are legacy. SharePoint has two page families:
Classic pages (legacy) Modern pages (current) Wiki pages, web part pages, blog pages, publishing pages Site Pages Classic UI, no mobile responsive Canvas layout with responsive web parts Created in Site Pages library with classic experience Created in Site Pages library with modern experience Not supported on modern team/communication sites Default on modern sites Use modern Site Pages for new work. For building custom page components, use SPFx client-side web parts.
Create, read, update, publish, and manage modern SharePoint pages. Modern pages use a canvas layout with web parts and can be promoted to news posts.
| Requirement | Description | Reference |
|---|---|---|
| Site Owner or Member role | Required to create, update, and delete pages. Read access for browsing. | SharePoint admin roles |
| Step | Operation | File | Required role | API reference |
|---|---|---|---|---|
| 1 | Paged: page through all pages by offset | paged.py |
Read access | Site pages API |
| 2 | Get content: read canvas and layout | get_content.py |
Read access | Site pages API |
| 3 | Create: add a new modern page | create.py |
Member on site | Site pages API |
| 4 | Create and publish: add + publish in one flow | create_and_publish.py |
Member on site | Site pages API |
| 5 | Promote to news: promote or demote as news post | promote_to_news.py |
Member on site | Site pages API |
| 6 | Report: pages across the site | report.py |
Read access | Site pages API |
| 7 | Export HTML: save every page as a .html file | export_html.py |
Read access | Site pages API |
from office365.sharepoint.client_context import ClientContext
ctx = ClientContext("https://contoso.sharepoint.com/sites/team").with_client_secret(
"contoso.onmicrosoft.com", "client_id", "client_secret"
)
# List all site pages
pages = ctx.web.site_pages.pages.get().execute_query()
for page in pages:
print(f" {page.file_name} : {page.title}")