MS SharePoint – Sites – Get Site Content Types
MS SharePoint – Sites – Get Site Content Types
Retrieves content types available at site scope. A content type describes a reusable schema; it is not a list record or file MIME type.
Action details
| Property | Value |
|---|---|
| Action label | MS SharePoint – Sites – Get Site Content Types |
| Category | CloudTools |
| Apex class and method | GetSharePointSiteContentTypes.getSiteContentTypes |
| Input type | GetSharePointSiteContentTypes.GetSharePointSiteContentTypesInput |
| Output type | List<List<SharePointContentType>> |
| Authorization | OAuth Delegated (Authorization Code) or OAuth Application (Client Credentials), subject to endpoint restrictions. |
| Microsoft Graph request | GET /v1.0/sites/{siteId}/contentTypes |
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 type | Declared alternatives |
|---|---|
| Delegated | Sites.Read.All, Sites.Manage.All, Sites.FullControl.All, Sites.ReadWrite.All |
| Application | Sites.Read.All, Sites.Manage.All, Sites.FullControl.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.
| Input | Apex field | Type | Required | Description |
|---|---|---|---|---|
| Site Id | siteId | String | Yes | SharePoint site identifier. |
| Filter | filterQuery | String | No | OData filter expression. Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values. |
| Select | selectQuery | String | No | Comma-separated properties to return. Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values. |
| Expand | expandQuery | String | No | Comma-separated related resources to expand. Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values. |
| Order By | orderbyQuery | String | No | Comma-separated properties to sort by. Supply the OData value only, without a query parameter name or full URL. Microsoft validates supported values. |
| Top | topQuery | String | No | Number of items to return. 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 outer result containing the resource collection for the first request. In Apex, read results[0]; Flow receives the collection output. The LWC library returns a flat array.
The implementation maps the response collection without following or exposing @odata.nextLink. Results can contain only the first page. Top, where exposed, controls the requested page size rather than guaranteeing complete retrieval. There is no continuation URL input.
| Output | Apex field | Type | Description |
|---|---|---|---|
| Id | id | String | Unique identifier for the content type. |
| Name | name | String | Name of the content type. |
| Description | description | String | Description of the content type. |
| Group | groupName | String | Group name the content type belongs to. |
| Parent Id | parentId | String | Identifier of the parent content type. |
| Hidden | hidden | Boolean | Whether the content type is hidden in the New menu. |
| Is Built In | isBuiltIn | Boolean | Whether the content type is built in. |
| Propagate Changes | propagateChanges | Boolean | Whether updates are pushed to inherited content types. |
| Read Only | readOnly | Boolean | Whether the content type is read-only. |
| Sealed | sealed | Boolean | Whether the content type is sealed. |
| ETag | eTag | String | Entity tag for optimistic concurrency. |
| OData Type | odataType | String | OData type for the content type. |
| OData ETag | odataEtag | String | OData ETag for the content type. |
| Inherited From | inheritedFrom | SharePointCTItemReference | Reference to the inherited source item. |
| Order | order | SharePointCTOrder | Ordering details for the content type. |
| Base | baseContentType | SharePointBaseContentType | Parent content type summary. |
| Base Types | baseTypes | List<SharePointBaseContentType> | Ancestor content type summaries. |
| Associated Hubs Urls | associatedHubsUrls | List<String> | Associated content type hub URLs. |
| Additional Properties | additionalProperties | List<DynamicObject> | Additional properties from user-defined query. |
Use in Flow
Add MS SharePoint – Sites – Get Site Content Types 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.GetSharePointSiteContentTypes.GetSharePointSiteContentTypesInput request =
new Apptigent.GetSharePointSiteContentTypes.GetSharePointSiteContentTypesInput();
request.siteId = 'REPLACE_WITH_SITE_ID';
List<List<Apptigent.SharePointContentType>> results =
Apptigent.GetSharePointSiteContentTypes.getSiteContentTypes(
new List<Apptigent.GetSharePointSiteContentTypes.GetSharePointSiteContentTypesInput>{ request }
);
List<Apptigent.SharePointContentType> items = results.isEmpty()
? new List<Apptigent.SharePointContentType>() : results[0];
System.debug(items.size());
Use in a Lightning Web Component
Use getSharePointSiteContentTypes 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 { getSharePointSiteContentTypes, 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';
const result = await getSharePointSiteContentTypes(request);
if (!Array.isArray(result)) {
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 a flat array without the outer Apex collection.
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
| Symptom | What to check |
|---|---|
| Required fields error | Supply a nonempty request list, a non-null first request, and the required identifiers or body values. |
| Authorization or access denied | Check connector selection, sign-in, application versus delegated permissions, administrator consent, and resource access. |
| Resource not found | Verify 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 items | Check query inputs, first-page behavior, supported expansions, item type, and mapped output limitations. |
| Unexpected connector | Review the connector selection behavior described above and the Microsoft 365 default connector. |
| Operation rejected | Inspect the Microsoft error, JSON field values, library or page state, supported API capabilities, and tenant policies. |