Forum Discussion

EnderTekin's avatar
EnderTekin
Copper Contributor
Dec 01, 2023

GraphAPI does not return headers collapsed by default

I'm using GraphAPI to access site pages published in Sharepoint sites. Normally, the innerHtml field contains the html I am looking for. However, there are some pages that have their headers collapsed by default. In this case, only the content of the sections are returned, but the headers themselves are not returned as part of the innerHtml or otherwise. Is this an issue with GraphAPI, or is there another way to return the headers?

 

The call is (using the Pages API, which I am aware is in beta):

 

 

 

GET https://graph.microsoft.com/beta/sites/<site_id>/pages/<page_id>/microsoft.graph.sitePage?expand=webParts

 

 

 

 

  • EnderTekin 

    Hi , 

    The GraphAPI does not return the headers collapsible section, however I`ve found an alternative way to retrieve the content including the heading .

     

    via https://graph.microsoft.com/beta/sites/{siteid}/lists/{listid}/items/{itemid}/fields?$select=canvascontent1

     

    However since the API is in beta version, it may subject to change at anytime. 

    Subscribe to GraphAPI updates for more information.

     

    How I figured out this field Canvascontent1 has this information?

    I`ve browsed via the SharePoint REST API

    xxx.sharepoint.com/sites/MyDevSite/_api/web/lists/getbyTitle('Site%20Pages')/items

    And searched for section heading which is collapsible 

    Its currently embedded in CanvasContent1 element, so I was able to retrieve the same using GraphAPI.

     

    Please be careful, if you integrate with any of applications , it might break if its gets embedded in a different element.

     

     

Resources