I need to start an approval when a document in a SharePoint online document library has been checked in. The approval must start when the editor is not equal to the responsible of the document. The responsible is added to the metadata of the library.

For that I'm using Flow but I got no trigger for that. There is only a trigger for when a document is created or edited. How can I make a workaround for that?

The reason why I don't want to trigger when a document is created or edited is because if the editors saved temporary, the flow run with an unfinished document. When it's checked in, the document is finished and then it has sense that the approval needs to start (when the condition for that evaluates successfully).

Question continuous here: Change a document metadata when it's checked out using Flow.

有帮助吗?

解决方案

You can use "Edited" trigger, but check document status using "Send an HTTP request to SharePoint" action.
You can use below REST query to get the document with status

_api/web/GetFileByServerRelativeUrl(@FileUrl)?@FileUrl='/sites/your-site/Docs/File.docx'&$select=CheckOutType,Level

CheckOutType:

  • 0: online
  • 1: offline
  • 2: none

File Level:

  • 1: published
  • 2: draft
  • 255: checkout

So you can check these properties in order to determine the state of a file and making a decision if flow should continue.
Additional reading: Checking if a SharePoint 2013 Page is Checked Out or Published with JavaScript and REST

其他提示

  1. Create a flow when a file is created or modified (properties only)
  2. Add a condition "Checked out is equal to false"

SharePoint Flow

Add a condition on settings of the "When a file is created or modified (properties only)" trigger:

enter image description here

许可以下: CC-BY-SA归因
scroll top