Repository navigation
Using the create and publish fails in a onsite Sharepoint #1060
|
I am trying to deploy this code in a onsite sharepoint 2019 with REST API using NTLM authentication i am able to list the pages I created this code from your example What works
What fails:
With this error. My code |
Replies: 4 comments
|
@vgrem i am not able to understand if this is a bug or not. |
|
Thanks for the report and the detailed example! The root cause appears to be a server-side schema mismatch between versions: The fix is to send only the members that are set, and I'm looking into it for an upcoming release. Until then, uploading the page as |
|
IS there a way that i can use the package and this command to actually generate the page .aspx as a file and leveraging the correct webparts? The goal is to find list that are already existing in the Sharepoint and create a .aspx where i can provide a customized view of the list ? Can we make the .aspx as output and then make the upload of file. |
|
Fixed in 3.3.1 (released 2026-11-07) — please upgrade and retry: pip install --upgrade office365-rest-python-clientThe cause was on our side. The draft-save request behind
On your follow-up (generating the ctx.web.get_folder_by_server_relative_url("/sites/x/SitePages").upload_file(...).execute_query()
ctx.web.get_folder_by_server_relative_url("/sites/x/SitePages").files.add("Page.aspx", html).execute_query()— and it can create a modern page from a canvas you supply: page = ctx.site_pages.create_page("My Page").execute_query()
page.save_page("My Page", canvas_content=canvas).execute_query()What it does not do is generate page markup. |
Fixed in 3.3.1 (released 2026-11-07) — please upgrade and retry:
The cause was on our side. The draft-save request behind
create_page()(save_draft()builds a
SitePageFieldsData) serialised every member of the type, so a create that setonly a title still carried a
CoAuthStatewith nothing in it — and a farm whose type hasno such property rejects the whole request, which is your error:
SaveDraftrequest{"Title": "x", "CoAuthState": {}}{"Title": "x"}ClientValue.to_json()now omits a nested value whose members are all unset.create_page()andcreate_and_publish_page()both go through that …