Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 73FlIg1aGMAznuXWWnvajV
Power Automate - Building Flows
Answered

Action to Unpublish an Approved SharePoint Document

Like (0) ShareShare
ReportReport
Posted on 9 Jun 2020 19:30:21 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

  • PratikD21 Profile Picture
    31 on 17 Jan 2022 at 11:03:05
    Re: Action to Unpublish an Approved SharePoint Document

    Hi @v-litu-msft ,

     

    Thanks for your solution. It worked !

     

    Regards,
    Pratik

  • sushma1503 Profile Picture
    3 on 20 Oct 2021 at 08:06:10
    Re: Action to Unpublish an Approved SharePoint Document

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

    sushma1503_0-1634717134023.png

     

     

  • lokeshpatel Profile Picture
    28 on 10 Feb 2021 at 22:24:01
    Re: Action to Unpublish an Approved SharePoint Document

    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

     

  • AntoinetteB Profile Picture
    145 on 10 Jun 2020 at 12:53:25
    Re: Action to Unpublish an Approved SharePoint Document

    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.  

  • Verified answer
    v-litu-msft Profile Picture
    on 10 Jun 2020 at 05:47:11
    Re: Action to Unpublish an Approved SharePoint Document

    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.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 51

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 39 Super User 2025 Season 1

#3
CU30040420-0 Profile Picture

CU30040420-0 23

Overall leaderboard
Loading started