How can I retrieve the values of custom columns from Sharepoint site pages via the Graph API?

Chris Freeday 0 Reputation points
2024-05-03T07:31:45.8266667+00:00

I know that the values can be extracted from items in documents and I know that I can extract the values of the default columns from site pages, but I cannot extract the values of custom created columns. Even when I try to add the page details as a horizontal section to a page, when I extract the webpart content, I only get the Ids of those references

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,783 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,793 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shawn Collins 595 Reputation points
    2024-05-03T20:26:17.3+00:00

    If you're unable to extract the values of custom created columns from site pages in SharePoint, it's possible that the custom columns are not being included in the page properties or are not accessible through the standard methods of extraction. Here are some steps you can take to troubleshoot and potentially resolve this issue:

    Check Column Settings: Ensure that the custom columns you created are included in the page content and are set to be visible and editable on the page. If the columns are hidden or not configured to appear on the page, they may not be accessible for extraction.

    Update Page Layout: If you're using a custom page layout, verify that it includes the necessary controls or placeholders for displaying and editing the custom columns. Sometimes, custom page layouts may not include support for all column types, leading to issues with extraction.

    Inspect Page Source: Use browser developer tools to inspect the HTML source code of the page and identify how the custom column values are represented. Look for unique identifiers or classes associated with the custom column elements that you can use for extraction.

    Explore SharePoint API: If the standard methods of extraction are not working, consider using SharePoint REST API or Microsoft Graph API to directly access and retrieve the values of the custom columns. You can make API requests to fetch page properties, including custom column values, using the appropriate endpoints.

    Review Permissions: Ensure that the account you're using to extract the values of custom columns has the necessary permissions to access and view the content of the site pages. Lack of permissions can sometimes prevent access to certain page properties, including custom column values.

    Consult SharePoint Documentation: Refer to the official SharePoint documentation or community forums for any specific guidance or best practices related to extracting custom column values from site pages. SharePoint's capabilities and APIs are continuously evolving, so it's possible that there may be updates or alternative methods available.

    By following these steps and exploring alternative approaches such as using SharePoint APIs, you should be able to extract the values of custom columns from site pages in SharePoint.