web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Action to Unpublish an...
Power Automate
Answered

Action to Unpublish an Approved SharePoint Document

(0) ShareShare
ReportReport
Posted on by 145

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, UnpublishSelect file, More, Unpublish

Categories:
I have the same question (0)
  • Verified answer
    v-litu-msft Profile Picture
    on at

    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.

  • AntoinetteB Profile Picture
    145 on at

    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.  

  • lokeshpatel Profile Picture
    28 on at

    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!

     

    lokeshpatel_0-1612995736434.png

     

  • sushma1503 Profile Picture
    3 on at

      The server relative url should be passed in place of the identifier  

    sushma1503_0-1634717134023.png

     

     

  • PratikD21 Profile Picture
    38 on at

    Hi @v-litu-msft ,

     

    Thanks for your solution. It worked !

     

    Regards,
    Pratik

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard