Hi folks, today we will see how to fix error You can only publish unpublish documents in a minor version enabled list in SharePoint.
The error comes when we edit SharePoint 2013/2016 or SharePoint Online list and add any component like web parts and check-in/check-out the page using CSOM.
The error comes as:
An unhandled exception of type ‘Microsoft.SharePoint.Client.ServerException’ occurred in SiteCreation.exe.
Additional information: You can only publish, unpublish documents in a minor version enabled list.
The error looks like below:
You can only publish unpublish documents in a minor version enabled list
We need to enable EnableMinorVersions property like below:
list.EnableMinorVersions = true;
The code looks like below:
You may like following SharePoint CSOM tutorials:
- Copy list items from one list to another in SharePoint programmatically using CSOM
- Steps to add items from CSV file to SharePoint Online List using PowerShell in CSOM
- How to Use CAML Query for Boolean field for SharePoint 2013/2016/Online Object Model CSOM
- Create an index in SharePoint Online list using CSOM
- Read CSV file from SharePoint document library programmatically using CSOM
- Activate SharePoint Server Publishing Feature programmatically using CSOM
- The collection has not been initialized SharePoint
- SharePoint rest api create a folder
- How to create a site column in SharePoint 2013/2016/Online
- SharePoint Workflow history list URL
This SharePoint tutorial, we learned how to fix an error You can only publish unpublish documents in a minor version enabled list.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com