BlackBrownBron

Automate SharePoint Version History Tracking with Power Automate

· Power Automate · Business Process Automation

Managing and tracking changes in SharePoint items can be a time-consuming task, especially when dealing with large lists and multiple versions. Fortunately, Power Automate provides a seamless solution to extract SharePoint version history and log relevant details into an Excel table. In this blog, we’ll walk through a Power Automate flow that automates this process, helping you streamline your workflow and improve efficiency.

Step-by-Step Breakdown

  1. Trigger: Manually Trigger a Flow
    • Type: Request (Button Trigger)
    • Description: This flow is triggered manually by a user pressing a button. The user provides inputs such as location and date, which can be utilized in subsequent actions.
    • Open Power Automate and create a new flow.
    • Select Instant Cloud Flow and choose Manually Trigger a Flow.

  2. Action: Get List of SharePoint Items
    • Type: OpenApiConnection
    • Operation: GetItems
    • Description: This action retrieves up to 2500 items from a specified SharePoint list, providing the necessary data for further processing.
    • Add a new step and search for SharePoint.
    • Select Get Items.
    • Configure the action by selecting the SharePoint site URL and list name.

  3. Control: Apply to Each SharePoint Item
    • Type: Foreach
    • Description: This control loops through each item retrieved from SharePoint.
    • Add the Apply to each action.
    • Select the value from the previous SharePoint Get Items action.

  4. Action: HTTP GET SharePoint Item History
    • Type: OpenApiConnection
    • Operation: HttpRequest
    • Description: Fetches the version history of each SharePoint item using an HTTP GET request.
    • Add a new step and search for HTTP.
    • Select Send an HTTP Request to SharePoint.
    • Configure the request to retrieve the version history of the item.

  5. Action: Parse JSON – SharePoint History
    • Type: ParseJson
    • Description: Converts the retrieved SharePoint history data into a structured JSON format for further processing.
    • Add a Parse JSON action.
    • Use the output from the HTTP request as input.
    • Define the schema to parse the response correctly.

  6. Control: For Each SharePoint History Item
    • Type: Foreach
    • Description: Iterates through each item in the version history.
    • Add another Apply to each action.
    • Select the parsed JSON history value.

  7. Action: Compose Retrieved SharePoint Item
    • Type: Compose
    • Description: Extracts relevant information from each version history entry.
    • Add a Compose action.
    • Extract relevant properties from the SharePoint item history.
    • Add a Compose action.
    • Extract relevant properties from the SharePoint item history.

  8. Action: Parse JSON Retrieved SharePoint Item
    • Type: ParseJson
    • Description: Converts the extracted SharePoint item data into a JSON format that can be processed in later steps.
    • Add another Parse JSON action.
    • Use the composed SharePoint item as input.

  9. Control: Apply to Each Retrieved SharePoint Item
    • Type: Foreach
    • Description: Iterates through each parsed SharePoint item.
    • Add another Apply to each action.
    • Select the parsed SharePoint item value.
  10. Action: Condition Check
    • Type: If
    • Description: Evaluates whether the Testingengagement property is null.
      • If Testingengagement is not null, the flow proceeds to the next action.
      • Otherwise, the iteration skips to the next item.
    • Add a Condition action.
    • Set the condition to check if the Testingengagement property is not null.

  11. Action: Add a Row into a Table
    • Type: OpenApiConnection
    • Operation: AddRowV2
    • Description: Inserts a new row into an Excel table with relevant details from the SharePoint item.
      • SharePoint ID
      • Version ID
      • Title
      • Created Date
      • Modified Date
      • Author Email Name
      • Modified By Email Name
    • If the condition is met, add a new step and search for Excel Online (Business).
    • Select Add a row into a table.
    • Configure the action by selecting the location, document library, file, and table.
    • Map the fields from the SharePoint item to the Excel table.

Summary

This Power Automate flow simplifies the process of tracking SharePoint version history by:

    • Automatically retrieving SharePoint list items and their version history.
    • Parsing and processing each version entry.
    • Extracting key details and logging them in an Excel table.
    • Ensuring that only relevant items (where Testingengagement is not null) are recorded.

With this solution in place, you can maintain a detailed log of SharePoint changes without manual effort, improving efficiency and data accuracy. Try implementing this flow in your environment and enhance your SharePoint data management today!