I am currently trying to get the whole content of a modern SharePoint page using either API but I am not retrieving it successfully. So far I have tried the following:
- Calling
https://xxxx.sharepoint.com/sites/{mysite}/_api/Web/lists/getbytitle('Site Pages')/items(x)/FieldValuesAsHtml
Doing so depending on the page I manage to get some content in the CanvasContent1 field. But unless it is an old SharePoint page or a plain looking one, I get no relevant content here.
- Calling
https://xxxx.sharepoint.com/sites/{mysite}/_api/Web/lists/getbytitle('Site Pages')/items(x)/FieldValuesAsText
Same thing as before, although whenever I get useful information, it looks better here than with FieldValuesAsHtml, again in the field CanvasContent1.
- Attempting it with the GraphAPI calling
https://graph.microsoft.com/beta/sites/{mysiteid}/pages/{mypageid}/webparts
When doing this only 2 fields are received: @odata.context
which contains a URL with an XML which doesn't solve anything for me and value
which is always blank"[]" for me.
- Also tried
https://graph.microsoft.com/beta/sites/{mysiteid}/pages/{mypageid}?expand=canvasLayout
but I am only getting something relevant in the description field and that is not the whole page.
I am trying all of this with Postman, I don't know if this might be relevant.
TLDR: What is the proper way of getting the whole content of a modern SharePoint page using either SharePoint API or Microsoft Graph API. Getting it as text/xml/html I do not care, any one works for me.