How to Add a Publish or Unpublish Button to a SharePoint Library
Question details
The user wants to add a one-click publish or unpublish button in a SharePoint document library to quickly manage document statuses.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Editing document metadata and attempting to manage document publication statuses directly from the library view.
- Observed behavior
- SharePoint document libraries do not provide a standard out-of-the-box button or default column-formatting option for publishing and unpublishing documents with a single click.
Ensure you have Site Owner or Full Control permissions in your SharePoint environment and access to Microsoft Power Automate to create custom workflows.
Create a Custom Publish/Unpublish Button using Power Automate
Build a custom column formatted as a clickable button that triggers a Power Automate flow to change the document's publishing status.
Since SharePoint lacks a default button for this action, you must combine SharePoint's JSON column formatting with a custom Power Automate flow. This allows you to simulate a one-click publish experience.
Go to Power Automate and create an instant cloud flow. Select 'For a selected file' as the SharePoint trigger. Add a subsequent action to 'Update file properties' or use a SharePoint HTTP request to change the publishing status of the selected document.
Navigate to your SharePoint document library. Click on 'Add column', choose 'Single line of text' or 'Choice', name the column 'Publish Document', and save it.
Click the header of your new 'Publish Document' column, select 'Column settings', and then 'Format this column'. Choose 'Advanced mode' and paste a JSON script designed to render the column as a button that calls your specific Power Automate Flow ID.
Select a document in the library and click the newly created button. Verify in Power Automate that the flow successfully runs and that the document's status updates to Published or Unpublished accordingly.

Use Built-in SharePoint Publishing Features via the Context Menu
If you prefer not to use custom code or Power Automate, rely on the standard publishing workflows available natively in SharePoint.
Try WPS Office for Streamlined Document Management
If complex SharePoint configurations and custom workflows are slowing down your productivity, consider switching to WPS Office. It provides a lightweight, unified suite for creating, editing, and managing documents without the hassle of setting up custom publishing scripts.
- 1. Download and install: Visit the official WPS Office website to download the free installation package for your PC or mobile device.
- 2. Open your documents directly: Launch WPS Office and open your existing Microsoft Office files. They will display seamlessly with perfect formatting compatibility.
- 3. Manage and collaborate: Use WPS Cloud to easily share file links and collaborate with team members without requiring complex publishing workflows.

Frequently Asked Questions
Why doesn't SharePoint have a default publish button in document libraries?
SharePoint is designed to rely heavily on versioning and strict content approval settings rather than a simple toggle button. Publishing is natively handled through the document's context menu or properties panel to ensure strict tracking and version control.
Can I use JSON column formatting without Power Automate to publish a document?
No. JSON column formatting alone only changes the visual appearance of the column (e.g., rendering text to look like a button). To actually execute an action like publishing or unpublishing, the button must trigger a Power Automate flow or invoke a custom SharePoint Framework (SPFx) extension.
Where can I get help with SharePoint custom development?
For advanced custom solutions, JSON formatting scripts, and Power Automate flow implementations, you can request expert guidance in the official Microsoft Q&A forums. Post your specific requirements and ensure you include the SharePoint tag.




