CSOM Publishing Page SharePoint Issue

Copper Contributor

We call the "ExecuteQuery" method on the context immediately after calling the “Add” method on the "FileCollection" and the file does get created but SharePoint returns the error message included below.

 

Error Message:

Microsoft.SharePoint.Client.ServerException: The file "[REDACTED]/Pages/Home.aspx" is not checked out. You must first check out this document before making changes.

at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)

at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()

at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)

at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()

2 Replies

@tpalacino Could you please go to the document library which host these contents, and click Library>Library settings>versioning settings. Here, set it to no for Require documents to be checked out before they can be edited.

 

Let me know if this works.

@Vikram_Samal Thanks. That might be a way to work around this error in the short term. There is still something fundamentally wrong though when given a list instance, calling the add method, and executing only that operation results in (a) the operation being successful and (b) the system returning an error message.

 

IMO it would be absolutely ridiculous for a platform to require a settings change in order to get a response that is consistent with the behavior.