Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The request message is too big. The server does not allow messages larger than 2097152 bytes. #820

Closed
1 task done
gopaldahal opened this issue Apr 10, 2022 · 5 comments
Closed
1 task done
Assignees
Labels
question Further information is requested

Comments

@gopaldahal
Copy link

Category

  • Bug

Describe the bug

Creating site pages with content larger than 2Mb throws unhandled exception.

Steps to reproduce

var libraryTitle = "SitePages"; var parentList = context.Web.Lists.GetByTitleAsync(libraryTitle, l => l.Title, l => l.Fields).Result; var content = System.IO.File.ReadAllText("D:\\Desktop\\pagewithtextstringlargerthen2mb.txt"); var page = context.Web.NewPage(); page.AddSection(CanvasSectionTemplate.OneColumn, 1); page.AddControl(page.NewTextPart(content), page.Sections[0].Columns[0]); page.Save("Heyram1.aspx");

Expected behavior

There should have been no exception

Environment details (development & target environment)

  • SDK version: [1.6.0 ]
  • OS: [Windows 10 ]
  • SDK used in: [Console App]
  • Framework: [.NET Framework v4.7.2 ]
  • Tooling: [Visual Studio 2022]

Additional context

Thanks for your contribution! Sharing is caring.

@jansenbe jansenbe self-assigned this Apr 19, 2022
@jansenbe jansenbe added the question Further information is requested label Apr 19, 2022
@jansenbe
Copy link
Contributor

Hey @gopaldahal , unfortunately this is a SharePoint Online limitation that cannot be configured (you should do this in on-premises SharePoint). When updating a page we actually update some fields in the page list item and when the total size of the list item update request exceeds the threshold this error is thrown. At the moment there's unfortunately nothing I can do about this and therefore I'll have to close this issue. The real solution will have to come with an official modern pages API, but that's not available at this moment. Hope you're not having too many of these big text parts? Alternatively split the page in multiple pages?

@heinrich-ulbricht
Copy link

Ran into this as well. I think I spotted an if somewhere checking if Graph should be used. Is there a modern API yet for large pages > 2 MB? @jansenbe

@jansenbe
Copy link
Contributor

jansenbe commented Oct 4, 2022

@heinrich-ulbricht : we're close to providing a beta version of the Graph pages API, integrating this API in PnP Core SDK however will take a while as we need a v1.0 version first and need to ensure we've full compatibility. Don't know your scenario, but using the beta Graph API might be a solution once it's available.

@heinrich-ulbricht
Copy link

heinrich-ulbricht commented Oct 5, 2022

@jansenbe Good to know, thanks for the feedback. Beta Graph API would be an option if it worked without issues. Breaking API changes (renamings etc.) might be something we can live with, flaky provisioning results or restrictions in functionality not so much (the page content is controlled by the user). This issue currently affects about 0.01% of pages which puts it a bit into perspective, though.

@heinrich-ulbricht
Copy link

heinrich-ulbricht commented Dec 25, 2023

Excited for the Graph pages API to be available in March 2024 :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants