Power Automate: Start a Flow from a column change

With Microsoft Power Automate we can now create flows that start based on specific columns being updated in SharePoint!  This is a feature I have been waiting on for years! The action is called Get changes for an item or a file. The action returns a boolean for each field, whether it was just changed or not. Based on this boolean you know if a field was changed.

Creating the flow

  • Create a SharePoint list, I created the following project list.
  • Enable versioning on the list.
  • Create a flow and use the trigger When an item or a file is modified.
  • Select your site and list.
  • Add the action Get changes for an item or a file (properties only).
  • Fill in the site address, library name and the ID of the item that was triggered.
  • The field Since is used to get the changes we need to make a comparison. If you use 1.0 you will compare the current item version with version 1.0. But we want the latest changes so we use the following expression.
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
  • I want to send an email when the end date of a project changes.
  • Add the action Conditions to check if the end date was changed.
  • Add the dynamic content Has Column Changed: End date.
    This returns a boolean value.
  • Put the required actions in the If yes section after the condition.
    In my example I am sending an email.
  • Add the action Send an email (V2) and fill in as follows.

Power Automate: Creating and updating a document set in SharePoint

Many colleagues have asked me how to create or update document sets with Power Automate. I had never done this before so I told them to use a web service. From now on, I can point them to this blog post. The flow is created with the help of my colleague Jasper Voskuilen, because this web service is a bit more complicated to setup.

Creating the flow

  • Open Power Automate and create a new flow (automation).
  • I created a flow with the trigger, for a selected item.
  • In my situation I get all items from a list and then create a document set for each result.
  • Create the following variables with the related values.
  • This will make the flow more dynamic for later changes.
  • SiteURL as a string, fill in the Site URL.
  • ContentType as a string, fill in the content type id.
  • URLLibrary as a string, fill in the library name part of the ULR.
    For this example it is: Library
https://domein.sharepoint.com/sites/ExampleSite/Library/Forms/allitems.aspx
  • TitleLibrary as a string, fill in the title (name) of the library.
  • WebServiceURLBibliotheek as a string, fill in the Library URL used by the web service.
  • You can find the web service url by using the following URL
https://domein.sharepoint.com/sites/ExampleSite/_vti_bin/listdata.svc/
  • Add the action Send an HTTP request to SharePoint
  • Use the varibles to configure the web service.
  • The name of the document set needs to be unique. I used a value from my list item, your situation might be different.
  • If required you can update the newly created document set.
  • Add the action Parse JSON and parse the Body of the Create Document set HTTP request.
  • Add the action Send an HTTP request to SharePoint
  • Use the variables to configure the web service.
  • The properties you need to set might be different than mine. I used values from my list item but your situation might be different.

Flow: Button to launch a Flow/Automate from a view

You can use column formatting (JSON) to create buttons that start a Flow on the corresponding list item in SharePoint. The button will be shown in the view for easy and fast access. After clicking the button the Flow Launch Panel will be displayed and you can start the Flow. This button is faster then clicking on the … then Flows followed by clicking the correct Flow.

Creating the button

  • Open the settings of the document library.
  • Create a new single line of text column with the name Start a Automate.
  • Go to a view where the new column is visible.
  • Open the menu of the column, click on Columns settings followed by Format this column.
  • If required click on the advanced mode option.
  • Copy and change the code below.
  • Change the txtContent to the name that needs to displayed as the value of the column. Currently it is Start the Automate.
  • Change the actionParams id to the Power Automate ID, see the steps below.
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"788b1689-e999-99d9-9f37-fc539d5ba36b\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "Flow"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "Start the Automate"
    }
  ]
}
  • Add the JSON code and save the changes.
  • The button can only start Power Automate from the default environment.

Finding the Automate ID

  • Open Power Automate.
  • Click on the name of the Automate.
  • In the ID is located in the URL after shared.
  • For the following Flow URL the ID is 788b1689-e999-99d9-9f37-fc539d5ba36b
  • The button can only start Automates form the default environment.
https://emea.flow.microsoft.com/manage/environments/Default-40ce6286-0e4a-4500-8bb1-bf46447c5f7f/flows/shared/788b1689-e999-99d9-9f37-fc539d5ba36b/details

Flow and Twitter

The default Twitter web part it great and easy to use. You can follow a Twitter user (@), a URL of a user account, tweet or collection. These options where not enough for a communications department who wanted to show the #, @Company, the company name and from:[Company] on a SharePoint page. We were able to do this with a PowerAutomate Flow and a custom content query web part. In this post I will explain how you can do this.

SharePoint: Create a list

  • Create a SharePoint list to store the twitter information.
  • We created the following columns to store the information, your requirements might be different.
Column nameType
Favorite countsNumber
Followers countsNumber
LocationSingle line of text
Media urlsMultiple lines of text
Original tweetMultiple lines of text
Original tweet tweeted bySingle line of text
TweetMultiple lines of text
Tweeted bySingle line of text
Created atDate and time
TweetIdSingle line of text
Original tweet idSingle line of text
TypeChoice
RetweetsSingle line of text
ProfileImageUrlNumber
NameUserSingle line of text

Flow: Getting the information

  • Open PowerAutomate and create a new Flow.
  • Add the trigger When a new tweet appears.
  • Enter the required search term, see the example below.
  • We wanted to be able to filter on the different types of results, for example on # or @. This information is added to the item that will be created in the SharePoint list.
  • A tweet can be multiple types so we need an array and append all the types to it.
  • Initialize a variable called TypeTweet as an array.
  • Add a scope called Append to array – TypeTweet.
  • Add a condition that filters the #Office365 out of the TweetText.
  • If the result is yes then append the value #Office365 to the array.
  • Repeat the steps for all types of tweets.
  • Add a scope called Create list item.
  • Add the SharePoint Create item action.
  • Connect all the columns to the correct information.

Custom Content Query Web part

We used a variation of the React Content Query Web Part from Github. This is a modern version of the CQWP where you have all the freedom to grab and style items from a list or library.

SharePoint: Get all the IDs

SharePoint has many IDs and when you are developing on SharePoint quite often you require one of these IDs. You might need the web ID or the Office 365 tenant ID. Not all of the IDs are easy to find. In this blog post I wrote done a list of various IDs and where to find them. If I missed one, feel free to leave a comment.

Office 365 tenant ID

  1. Sign in to the Azure Active Directory admin center as a global or user management admin.
  2. Under Manage, select Properties. The tenant ID is shown in the Directory ID box.
  3. Or try the direct link. https://aad.portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Properties

Web ID for a SharePoint site

The web ID of a site can be found with the help of the API.

SharePoint on-premise

https://<site>/_api/web/id

SharePoint Online

https://<site>.SharePoint.com/_api/web/id

SharePoint Online sub site collection

https://<site>.sharepoint.com/sites/<subsitecoll>/_api/web/id

Content type ID

  • Navigate to the location of the content type.
    • For example open the list settings.
    • Click on the content type name.
  • Open the settings page of the content type.
  • The ID is located in URL after ctype=
_layouts/15/ManageContentType.aspx?ctype=0x01010050A0D7467D640B4A90298761CEAB2DBF04

List ID

  • Navigate to the location of the list.
  • Open the list settings.
  • The ID is located in URL after List=
_layouts/15/listedit.aspx?List=9db54e81-a910-44e5-a2fc-ac3e0733bc71

Document Library ID

  • Navigate to the location of the list.
  • Open the list settings.
  • The ID is located in URL after List=
_layouts/15/listedit.aspx?List=0e93dff3-5530-4503-8b42-8b8cbbdee663

Role IDs

SharePoint uses role IDs to create the permissions levels for SharePoint Groups. These role IDs are a set of numbers that define the precise permissions level details. You can read in the blog post SharePoint: Get the Role ID on how to find the role IDs.

List workflow ID

  • Navigate to the list.
  • Open the workflow settings.
  • Click on the name of the workflow, this opens the setting for the worklfow.
  • The ID is located in URL after SubscriptionId=
    • The { and } are not part of the ID.
/_layouts/15/AddWrkfl.aspx?List={45743782-4F04-4E33-8605-4E1DCBBCE44E}&SubscriptionId={1F6A7AF5-E671-42A5-AB35-66376F42FF99}

Site workflow ID

  • Navigate to the site.
  • Open the workflow settings.
  • Click on the name of the workflow, this opens the setting for the worklfow.
  • The ID is located in URL after SubscriptionId=
    • The { and } are not part of the ID.
/_layouts/15/AddWrkfl.aspx?List={45743782-4F04-4E33-8605-4E1DCBBCE44E}&SubscriptionId={1F6A7AF5-E671-42A5-AB35-66376F42FF99}

Permission group ID

  • Note that permission group IDs are unique within a site collection.
  • Navigate to the location of the permission group and open the group.
  • The ID is located in URL after MembershipGroupId=
/_layouts/15/people.aspx?MembershipGroupId=41

Office 365: What’s new

In the last several weeks there where a lot of Office 365 announcements. To many to mention all but these are my favorites ones.

Whiteboard in Teams

Microsoft Whiteboard is now available as a commercial preview in Teams! You will be able to create and share a digital whiteboard with everybody in the meeting. Ink beautification is my favorite feature, this will analyzes my hard to read handwriting and changes it into readable text.



Multi-Geo in SharePoint and Office 365 Groups

Multi-Geo Capabilities in SharePoint Online and Office 365 Groups is no longer in preview but available for everybody. Multi-Geo in SharePoint and Groups enables global businesses control the country or region where shared resources like SharePoint Team Sites, Office 365 Groups content (associated SharePoint Sites and Groups mailboxes) are stored at-rest.

SharePoint News

The news features of SharePoint is upgraded with new capabilities to further empower the news experience. My favorite feature is the Authoritative news, this will make sure that news from a authoritative or official source will always be displayed on the SharePoint home in Office 365 and on the news tab in SharePoint mobile.



Yammer tab in Microsoft Teams

Yammer can now be added as a tab in Teams! A specified group or topic feed from Yammer will be displayed on the tab.



Copy a plan in Planner

Create a a new plan by duplication an existing one, quick and easy.