Hi, how do I unpublish a SharePoint document using a Power Automate flow action?
This is a content approval library where documents with an Approval Status of Approved can be unpublished back to the last minor version in Pending, by selecting the file, then choosing More, then choosing Unpublish in SharePoint.
I want to do this same thing using Power Automate. Select an Approved file and unpublish it. I know how to set up the if statement to check whether or not the content approval status is Approved. I need help with the action to unpublish the selected file. This is the last thing I need to figure out . . . and I'm stuck.
Thank you.
Select file, More, Unpublish
The server relative url should be passed in place of the identifier
Hi @v-litu-msft,
I tried your approach to the REST API, but cannot seem to get it to work. I get an error of:
serverRelativeUrl Parameter name: Specified value is not supported for the serverRelativeUrl parameter.
The uri is: /_api/web/getfilebyserverrelativeurl('Policies%252fPower%2bApp%2bCertification.pptx')/unpublish(comment='test').
Any ideas? Thanks in advance!
Thank you. I am not a coder so I'm not able to test this. I do not know how to call POST REST API requests and I will instead have to use check out/check in or look for some other way to deal with the problem of someone sending an Approved document through an approval flow. I will mark as solution because reading over your steps I can follow the logic enough to tell this is probably the only way to do it.
Hi @AntoinetteB,
There is no direct action that could be used to unpublish the file in Flow. But you are familiar with using request API, you could consider using Send HTTP request to SharePoint action.
To unpublish a document, you can call the following POST REST API request (Files and folders REST API reference ) - don't forget to get the request digest and add it as a header of the following request :
http://your_sharepoint_site_url/_api/web/getfilebyserverrelativeurl('/your_site/your_Library/your_filename.docx')/unpublish(comment='Check-in comment for the unpublish operation.')
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
stampcoin
51
Michael E. Gernaey
39
Super User 2025 Season 1
CU30040420-0
23