Skip to content

SharePoint REST API: Issue updating CanvasContent1 #3526

@DroopyTersen

Description

@DroopyTersen

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

I would expect to able to update a Modern Page's CanvasContent1 property via the REST API.

Observed Behavior

  • On my Dev tenant, the REST API request works as expected, updating the Page's content.
  • On my Production tenant, the request succeeds, returning with a 204, however the CanvasContent1 property does not actually get updated. The page maintains the previous CanvasContent1.
  • Using the same REST API technique on the "broken" Prod tenant, I am able to successfully update other page properties, including LayoutWebpartsContent.
  • Using PnP Powershell works as expected. I am able to successfully update CanvasContent1 on both Tenants.

Is there tenant, site or library level property that might prevent the REST API from persisting the CanvasContent1 property update?

Steps to Reproduce

I am performing the following SharePoint REST API HTTP Request from inside a SPFx webpart (currently from /_layouts/workbench.aspx of the target site.

fetch(
	"https://TENANT.sharepoint.com/sites/THE_SITE/_api/Web/Lists(guid'a1ba5ef3-2c67-4b42-9cc9-4af7b95d9372')/Items(5)",
	{
		credentials: "include",
		headers: {
			accept: "application/json;odata=verbose",
			"accept-language": "en-US,en;q=0.9",
			"cache-control": "no-cache",
			"content-type": "application/json;odata=verbose",
			"if-match": "*",
			pragma: "no-cache",
			"x-http-method": "MERGE",
			"x-requestdigest": "DIGEST IS HERE,01 Mar 2019 15:15:06 -0000",
		},
		referrer: "https://TENANT.sharepoint.com/sites/THE_SITE/_layouts/15/workbench.aspx",
		referrerPolicy: "no-referrer-when-downgrade",
		body: JSON.stringify({ __metadata: {"type":"SP.Data.SitePagesItem"}, CanvasContent1: `<div>I took the CanvasContent1 from a different page and set it here</div>` }),
                method: "POST",
	}
);

As stated above:

  • Using the the same code, but setting LayoutWebpartsContent instead works as expected.
  • The exact same code works as expected to update CanvasContent1 in my Dev tenant

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APIstatus:trackedCurrently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed)type:archive-old-issueIssues which are closed as tool old for active worktype:bug-confirmedConfirmed bug, not working as designed / expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions