Resonate IT
  • Home
  • Services
    • Expertise
    • Development
    • Support
  • Contact
    • In Progress
  • Blog

Blog

Microsoft Flow - Only run when Document is Published

17/9/2018

1 Comment

 
Sometimes you only want a Flow to run when a document is published, particularly when it comes to document approvals. Currently, Microsoft Flow doesn't yet have an 'on publish' trigger so we need the Flow to run whenever the document is modified, and only continue if the document has just been published. Here's how:
  1. Start with a 'When a file is created or modified (properties only)'  SharePoint trigger
  2. Add a 'Send an HTTP request to SharePoint' action with the following values:
    1. Site Address: your site address
    2. Method: GET
    3. Uri: _api/web/lists/getbytitle('YOURLIBRARYNAME')/items(DOCUMENTID)/FieldValuesAsText
    4. Headers: 
      1. Accept: application/json;odata=verbose
      2. Content-Type: application/json;odata=verbose
  3. Now we need to parse the response into a format that Flow can recognize. Add a 'Parse JSON' action with the following values:
    1. Content: The 'Body' from the HTTP Request response
    2. Schema: Use the schema provided at the end of this post
  4. Finally, you can access the 'OData__x005f_ModerationStatus' value from the 'Parse JSON' output to determine the document's published status. "Pending" means that the document has just been published.
Schema

    
1 Comment

    Archives

    September 2018
    August 2018
    February 2017
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016

    Categories

    All
    Business
    Content Management
    Microsoft Flow
    Office 365
    SharePoint
    SharePoint Online

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • Services
    • Expertise
    • Development
    • Support
  • Contact
    • In Progress
  • Blog