MS SharePoint – Pages – Get Page

Estimated reading: 5 minutes

MS SharePoint – Pages – Get Page

Retrieves one modern site page by its page ID. Expand can request supported relationships such as canvasLayout. The result contains mapped page metadata and optional layout data rather than a rendered browser page.

Action details

PropertyValue
Action labelMS SharePoint – Pages – Get Page
CategoryCloudTools
Apex class and methodGetSharePointSitePage.getPage
Input typeGetSharePointSitePage.GetSharePointSitePageInput
Output typeList<SharePointSitePage>
AuthorizationOAuth Delegated (Authorization Code) or OAuth Application (Client Credentials), subject to endpoint restrictions.
Microsoft Graph requestGET /v1.0/sites/{siteId}/pages/{pageId}/microsoft.graph.sitePage

Prerequisites and permissions

Configure a CloudTools Connector with Connector Type set to Microsoft 365. Complete user sign-in for delegated access. For supported application access, grant application permissions and administrator consent. The calling identity must have access to the relevant site, list, library, or item; tenant policy and resource configuration still apply.

The action permission provider declares the following permission alternatives. These are not cumulative requirements and not all are least privileged. Check the linked Microsoft reference for the endpoint, authorization type, and current restrictions.

Permission typeDeclared alternatives
DelegatedSites.Read.All, Sites.ReadWrite.All
ApplicationSites.Read.All, Sites.ReadWrite.All

See the Microsoft operation and permissions reference.

Inputs

Supply one non-null request with nonblank required identifiers. IDs must belong to the indicated site, list, or drive; do not substitute Salesforce IDs or browser URLs.

InputApex fieldTypeRequiredDescription
Site IdsiteIdStringYesSharePoint site identifier.
Page IdpageIdStringYesSharePoint page identifier.
SelectselectQueryStringNoComma-separated properties to return. Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values.
ExpandexpandQueryStringNoComma-separated related resources to expand (for example canvasLayout). Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values.

The global invocable input does not expose connectorId. Direct subscriber Apex and Flow calls use CloudTools connector selection. Resolve dynamic values before invocation; this action does not resolve replacement tokens.

Outputs

Returns one SharePointSitePage inside a list, or an empty list if no response is mapped. Check for an empty result before reading fields.

OutputApex fieldTypeDescription
IdidStringUnique identifier for the page.
NamenameStringPage name.
TitletitleStringPage title.
DescriptiondescriptionStringPage description.
Web URLwebUrlStringWeb URL of the page.
Created Date TimecreatedDateTimeStringCreated date and time for the page.
Last Modified Date TimelastModifiedDateTimeStringLast modified date and time for the page.
Page LayoutpageLayoutStringLayout type for the page.
Promotion KindpromotionKindStringPromotion kind for the page.
Thumbnail Web URLthumbnailWebUrlStringThumbnail URL for the page.
Publishing StatepublishingStateSharePointPublishingStatePublishing state for the page.
Created By UsercreatedByUserSharePointIdentitySetUser identity that created the page.
Last Modified By UserlastModifiedByUserSharePointIdentitySetUser identity that last modified the page.
Parent ReferenceparentReferenceSharePointParentReferenceParent site/list reference for the page.
OData TypeodataTypeStringOData type for the page.
OData ETagodataEtagStringOData ETag for the page.
Additional PropertiesadditionalPropertiesList<DynamicObject>Additional properties from user-defined query.

Layout and title-area properties are mapped into their model types only when returned. Request supported expansions where needed; this is metadata, not rendered HTML.

Use in Flow

Add MS SharePoint – Pages – Get Page in Flow Builder. Use a Microsoft 365 application connector configured as Set as default for Flow automations, supply the required resource IDs, and add fault handling. Delegated connections are not supported for CloudTools Flow automation. This implementation processes only the first input request and is not a bulk operation.

Use in custom Apex

This subscriber-org example uses the Apptigent namespace. Replace the identifiers, configure the connector, and run in a context that permits callouts. Arrange authorization before calling and handle exceptions in the caller.

Apptigent.GetSharePointSitePage.GetSharePointSitePageInput request =
    new Apptigent.GetSharePointSitePage.GetSharePointSitePageInput();
request.siteId = 'REPLACE_WITH_SITE_ID';
request.pageId = 'REPLACE_WITH_PAGE_ID';

List<Apptigent.SharePointSitePage> results =
    Apptigent.GetSharePointSitePage.getPage(
        new List<Apptigent.GetSharePointSitePage.GetSharePointSitePageInput>{ request }
    );

Apptigent.SharePointSitePage item = results.isEmpty() ? null : results[0];
System.debug(item == null ? null : item.id);

Use in a Lightning Web Component

Use getSharePointSitePage from msSharePointConnectorLib, through MSSharePointConnectorController. These c/ imports apply to an LWC in the same namespace. The function accepts one request object, including connectorId when applicable.

Set request.connectorId to select a configured Connector record. The controller passes this request selection through SharePointAction. The field belongs to the controller request, not the global invocable input type.

sharePointActionExample.js

import { LightningElement } from 'lwc';
import { getSharePointSitePage, MSSharePointObjects } from 'c/msSharePointConnectorLib';

export default class SharePointActionExample extends LightningElement {
    connectorId = 'REPLACE_WITH_CONNECTOR_RECORD_ID';
    result = null;
    errorMessage = '';
    isRunning = false;
    completed = false;

    async handleRun() {
        if (this.isRunning) {
            return;
        }
        this.isRunning = true;
        this.errorMessage = '';
        try {
            const request = MSSharePointObjects.inputs.site();
            request.connectorId = this.connectorId;
            request.siteId = 'REPLACE_WITH_SITE_ID';
            request.pageId = 'REPLACE_WITH_PAGE_ID';
            const result = await getSharePointSitePage(request);
            if (!result?.id) {
                throw new Error('The action did not return a usable result.');
            }
            this.result = result;
            this.completed = true;
        } catch (error) {
            this.errorMessage = error.requiresInteractiveAuthorization
                ? 'Sign in to Microsoft for the connector, then try again.'
                : error.message || 'The SharePoint action failed.';
        } finally {
            this.isRunning = false;
        }
    }
}

sharePointActionExample.html

<template>
    <lightning-button label="Run action" onclick={handleRun}
        disabled={isRunning}></lightning-button>
    <p role="alert">{errorMessage}</p>
</template>

The library resolves to one mapped resource object or null.

LWC rawJson serializes the mapped Apex object; it is not the untouched Microsoft response or an additional global invocable output. Use getMSSharePointAuthorizationState, beginMSSharePointAuthorization, and createMSSharePointOAuthMessageHandler to arrange delegated sign-in. The library normalizes controller errors, including requiresInteractiveAuthorization when available; it does not automatically sign in or retry.

Error handling and troubleshooting

SymptomWhat to check
Required fields errorSupply a nonempty request list, a non-null first request, and the required identifiers or body values.
Authorization or access deniedCheck connector selection, sign-in, application versus delegated permissions, administrator consent, and resource access.
Resource not foundVerify the parent site, list, and drive IDs. Distinguish list item IDs from drive item IDs and retain permission or version IDs with their resource.
Missing fields or itemsCheck query inputs, first-page behavior, supported expansions, item type, and mapped output limitations.
Unexpected connectorReview the connector selection behavior described above and the Microsoft 365 default connector.
Operation rejectedInspect the Microsoft error, JSON field values, library or page state, supported API capabilities, and tenant policies.
Share this Doc

MS SharePoint – Pages – Get Page

Or copy link

CONTENTS

Free eBook: The Ultimate Guide to Power Platform Custom Connectors

Antimanual

Ask our AI support assistant your questions about our platform, features, and services.

You are offline
Chatbot avatar
What can I help you with?

Subscribe

×
Cancel