© Vijai Anand Ramalingam 2018

Vijai Anand Ramalingam, Introducing Microsoft Flow, https://doi.org/10.1007/978-1-4842-3630-7_2

2. Tutorials

Vijai Anand Ramalingam

(1)New Jersey, USA

In this chapter, you will learn how to

  • Create flows using different connectors, triggers, and actions

  • Create flows using conditions, switch cases, parallel actions, expressions, and more

  • Create flows from SharePoint, OneDrive, and Microsoft Teams

You’ll explore the different scenarios via examples.

Save Tweets That Include a Specific Hashtag to a SharePoint List

In this section, you will learn how to create a flow to save tweets that include a specific hashtag to a SharePoint list. A SharePoint Online list named Tweets will be used to save the tweets. It consists of two fields: Title (single line of text) and Tweet (multiline of text), as shown in Figure 2-1.

A464567_1_En_2_Fig1_HTML.jpg
Figure 2-1 SharePoint custom list named Tweets

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from template link shown in Figure 2-2.

    A464567_1_En_2_Fig2_HTML.jpg
    Figure 2-2 The Create from a template link
  3. Click the Data collection category and type the Twitter keyword in the search text box. Click the Save tweets that include a specific hashtag to a SharePoint list template shown in Figure 2-3.

    A464567_1_En_2_Fig3_HTML.jpg
    Figure 2-3 Select the template
  4. Sign into your SharePoint Online and Twitter accounts by clicking Sign in. Once you have successfully connected to SharePoint and Twitter, click Continue, as shown in Figure 2-4.

    A464567_1_En_2_Fig4_HTML.jpg
    Figure 2-4 Continue to create the flow
  5. Figure 2-5 shows the trigger and action that will be added by default as part of the template.

    A464567_1_En_2_Fig5_HTML.jpg
    Figure 2-5 Trigger and action
  6. Go to the When a new tweet appears trigger and enter the search text shown in Figure 2-6. Note that search text is case-insensitive.

    A464567_1_En_2_Fig6_HTML.jpg
    Figure 2-6 The new trigger
  7. Go to the Create item action and select or add values to the Site Address, List Name, Title, and Tweet fields, as shown in Figure 2-7.

    A464567_1_En_2_Fig7_HTML.jpg
    Figure 2-7 Create an item action
  8. After you’ve made all of the changes, enter a name for the flow or leave the default name, as shown in Figure 2-8. Click Create Flow.

    A464567_1_En_2_Fig8_HTML.jpg
    Figure 2-8 Save and create the flow
  9. The flow has been created successfully. Click Done, as shown in Figure 2-9.

    A464567_1_En_2_Fig9_HTML.jpg
    Figure 2-9 Flow created
  10. Figure 2-10 shows the details of the newly created flow.

    A464567_1_En_2_Fig10_HTML.jpg
    Figure 2-10 Flow details

To test your flow, perform the following steps:

  1. Navigate to your Twitter account. Post a new tweet and add the hash tag #SharePoint, as shown in Figure 2-11.

    A464567_1_En_2_Fig11_HTML.jpg
    Figure 2-11 Post a tweet
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to your SharePoint Online list and you should see a new item, as shown in Figure 2-12.

    A464567_1_En_2_Fig12_HTML.jpg
    Figure 2-12 New SharePoint list item

Thus, in this section, you learned how to create a flow to save tweets that include a specific hashtag to a SharePoint list.

Save Email Attachments to a SharePoint Document Library and Get a Notification

In this section, you will learn how to create a flow to save email attachments to a SharePoint document library and get a notification.

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from template link.

  3. Click the Notifications category and type save my email in the search text box. Click the Save my email attachments to a SharePoint and get a notification template, as shown in Figure 2-13.

    A464567_1_En_2_Fig13_HTML.jpg
    Figure 2-13 Select a template
  4. Sign into your SharePoint Online, Notifications, and Office 365 Outlook accounts by clicking Sign in. Once connected, click Continue, as shown in Figure 2-14.

    A464567_1_En_2_Fig14_HTML.jpg
    Figure 2-14 Continue to create the flow
  5. Figure 2-15 shows the trigger and actions that will be added by default as part of the template.

    A464567_1_En_2_Fig15_HTML.jpg
    Figure 2-15 Trigger and actions
  6. Go to the On new email trigger and select the Office 365 Outlook folder, as shown in Figure 2-16 and Figure 2-17.

    A464567_1_En_2_Fig16_HTML.jpg
    Figure 2-16 Select the Office 365 Outlook folder
    A464567_1_En_2_Fig17_HTML.jpg
    Figure 2-17 Inbox folder selected
  7. Go to the Create file action and fill in the Site Address and Folder Path fields, as shown in Figure 2-18.

    A464567_1_En_2_Fig18_HTML.jpg
    Figure 2-18 The Create file action
  8. Go to the Send a push notification action. If required, update the default values based on your requirements, as shown in Figure 2-19.

    A464567_1_En_2_Fig19_HTML.jpg
    Figure 2-19 Send a push notification
  9. After you’ve made the changes, enter a name for the flow or leave the default name, as shown in Figure 2-20. Click Create Flow.

    A464567_1_En_2_Fig20_HTML.jpg
    Figure 2-20 Save and create the flow
  10. The flow has been created successfully. Click Done, as shown in Figure 2-21.

    A464567_1_En_2_Fig21_HTML.jpg
    Figure 2-21 Flow created
  11. Figure 2-22 shows the details of the newly created flow.

    A464567_1_En_2_Fig22_HTML.jpg
    Figure 2-22 Flow details

To test your flow, perform the following steps:

  1. Send an email with attachments to your Office 365 Outlook account, as shown in Figure 2-23.

    A464567_1_En_2_Fig23_HTML.jpg
    Figure 2-23 Email with attachments
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to the selected SharePoint folder and you should see the Outlook email attachments saved as documents, as shown in Figure 2-24.

    A464567_1_En_2_Fig24_HTML.jpg
    Figure 2-24 Email attachments uploaded to a SharePoint folder
  3. Make sure to download the mobile app and connect to receive notifications. Refer to Chapter 4 to learn more about the mobile app.

Thus, in this section, you learned how to create a flow to save email attachments to a SharePoint folder and get a notification.

Send an Email When an Item Is Modified in a SharePoint List

In this section, you will learn how to create a flow to send an email when an item is modified in a SharePoint list. A SharePoint Online list named Project Tracker will be used. It consists of the following fields (also shown in Figure 2-25):

  • Project Name (single line of text)

  • Description (multiple lines of text)

  • Project Type (choice)

  • Status (choice)

A464567_1_En_2_Fig25_HTML.jpg
Figure 2-25 Project Tracker SharePoint list

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from template link.

  3. Click the Email category and type the sharepoint keyword in the search text box. Click the When an item in a SharePoint list is modified send an email template, as shown in Figure 2-26.

    A464567_1_En_2_Fig26_HTML.jpg
    Figure 2-26 Select a template
  4. Click Edit in advanced mode, as shown in Figure 2-27.

    A464567_1_En_2_Fig27_HTML.jpg
    Figure 2-27 The Edit in advanced mode button
  5. Go to the When an existing item is modified trigger and fill in the Site Address and List Name fields with the information shown in Figure 2-28.

    A464567_1_En_2_Fig28_HTML.jpg
    Figure 2-28 Trigger parameters
  6. Go to the Send Email action and enter a value for the To address (to whom email has to be sent), as shown in Figure 2-29.

    A464567_1_En_2_Fig29_HTML.jpg
    Figure 2-29 Send an email
  7. After you’ve made the changes, enter a name for the flow or leave the default name, as shown in Figure 2-30. Click Create Flow.

    A464567_1_En_2_Fig30_HTML.jpg
    Figure 2-30 Save and create a flow
  8. The flow has been created successfully. Click Done, as shown in Figure 2-31.

    A464567_1_En_2_Fig31_HTML.jpg
    Figure 2-31 The flow has been created
  9. Figure 2-32 shows the details of the newly created flow.

    A464567_1_En_2_Fig32_HTML.jpg
    Figure 2-32 Flow details

To test your flow, perform the following steps:

  1. Navigate to the SharePoint Online list and modify an existing item, as shown in Figure 2-33.

    A464567_1_En_2_Fig33_HTML.jpg
    Figure 2-33 Update an existing list item
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to your Office 365 Outlook and you should see a new email, as shown in Figure 2-34.

    A464567_1_En_2_Fig34_HTML.jpg
    Figure 2-34 Received email

Thus, in this section, you learned how to create a flow to send an email when an item is modified in a SharePoint list.

Add an Event to Google Calendar When an Item Is Added in SharePoint

In this section, you will learn how to create a flow to add an event to Google Calendar when an item is added in SharePoint. A SharePoint Online list named Conference Details will be used for this flow. It consists of following fields (also shown in Figure 2-35):

  • Title (single line of text)

  • Description (multiple lines of text)

  • Start Date (date and time)

  • End Date (date and time)

  • Location (location)

A464567_1_En_2_Fig35_HTML.jpg
Figure 2-35 Conference Details SharePoint list

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from template link.

  3. Click the Events and calendar category and type the sharepoint keyword in the search text box. Click the Add an event when an item is added in SharePoint template shown in Figure 2-36.

    A464567_1_En_2_Fig36_HTML.jpg
    Figure 2-36 Select a template
  4. Sign into your SharePoint Online and Google Calendar accounts by clicking Sign in. Once connected to SharePoint and Google Calendar, click Continue, as shown in Figure 2-37.

    A464567_1_En_2_Fig37_HTML.jpg
    Figure 2-37 Continue to create the flow
  5. Go to the When a new item is created trigger and fill in the Site Address and List Name fields, as shown in Figure 2-38.

    A464567_1_En_2_Fig38_HTML.jpg
    Figure 2-38 Trigger parameters
  6. Go to the Create an event action and add dynamic content to the parameters, as shown in Figure 2-39.

    A464567_1_En_2_Fig39_HTML.jpg
    Figure 2-39 Add dynamic content
  7. After you’ve made the changes, enter a name for the flow or leave the default name, as shown in Figure 2-40. Click Create Flow.

    A464567_1_En_2_Fig40_HTML.jpg
    Figure 2-40 Save and create the flow
  8. The flow has been successfully created. Click Done, as shown in Figure 2-41.

    A464567_1_En_2_Fig41_HTML.jpg
    Figure 2-41 The flow has been created
  9. Figure 2-42 shows the details of the newly created flow.

    A464567_1_En_2_Fig42_HTML.jpg
    Figure 2-42 Flow details

To test your flow, perform the following steps:

  1. Navigate to the SharePoint Online Conference Details list and create a new item, as shown in Figure 2-43.

    A464567_1_En_2_Fig43_HTML.jpg
    Figure 2-43 Create a new item
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to your Google calendar and you should see a new event, as shown in Figure 2-44.

    A464567_1_En_2_Fig44_HTML.jpg
    Figure 2-44 New event created in Google Calendar
  3. When you create a date field in a SharePoint list, make sure you select “Date & Time.” Otherwise the flow will fail due to an incorrect date format, as shown in Figure 2-45.

    A464567_1_En_2_Fig45_HTML.jpg
    Figure 2-45 Invalid date format issue

Thus, in this section, you learned how to create a flow to add an event to Google Calendar when an item is added in SharePoint.

Create a Flow from a SharePoint Online List

In this section, you will learn how to create a flow from a SharePoint Online list to post a message to Yammer. A SharePoint Online list named Conference Details will be used for this flow. It consists of the following fields (also shown in Figure 2-46):

  • Title (single line of text)

  • Description (multiple lines of text)

  • Start Date (date and time)

  • End Date (date and time)

  • Location (location)

A464567_1_En_2_Fig46_HTML.jpg
Figure 2-46 Conference Details SharePoint List

Perform the following steps:

  1. Navigate to a SharePoint Online list. For example, https://c986.sharepoint.com/sites/Flow/Lists/Conference%20Details/AllItems.aspx .

  2. In the menu, click Flow and then click Create a flow, as shown in Figure 2-47.

    A464567_1_En_2_Fig47_HTML.jpg
    Figure 2-47 Create a flow
  3. Click Post a message to Yammer for a selected item template, as shown in Figure 2-48.

    A464567_1_En_2_Fig48_HTML.jpg
    Figure 2-48 Select a template
  4. Sign into your SharePoint Online and Yammer accounts by clicking Sign in. Once connected to SharePoint and Yammer, click Continue, as shown in Figure 2-49.

    A464567_1_En_2_Fig49_HTML.jpg
    Figure 2-49 Continue to create the flow
  5. Go to the Get item action and leave the default values for the parameters, as shown in Figure 2-50.

    A464567_1_En_2_Fig50_HTML.jpg
    Figure 2-50 Action parameters
  6. Go to the Post message action, select the Group ID from the drop-down, and update the message text by adding the dynamic content shown in Figure 2-51.

    A464567_1_En_2_Fig51_HTML.jpg
    Figure 2-51 Add dynamic content
  7. Go to the For a selected item trigger, click Edit, and delete the input message, as shown in Figure 2-52.

    A464567_1_En_2_Fig52_HTML.jpg
    Figure 2-52 The For a selected item action
  8. After you’re done with the changes, enter a name for the flow or leave the default name, as shown in Figure 2-53. Click Create Flow.

    A464567_1_En_2_Fig53_HTML.jpg
    Figure 2-53 Save and create the flow
  9. The flow has been created successfully. Click Done, as shown in Figure 2-54.

    A464567_1_En_2_Fig54_HTML.jpg
    Figure 2-54 The flow has been created
  10. Figure 2-55 shows the details for the newly created flow.

    A464567_1_En_2_Fig55_HTML.jpg
    Figure 2-55 Flow details

To test your flow, perform the following steps:

  1. Navigate to the SharePoint Online Conference Details list, select an existing item, and click more options. Click Flow and then click the flow that you created, as shown in Figure 2-56.

    A464567_1_En_2_Fig56_HTML.jpg
    Figure 2-56 Run a flow for an existing item
  2. Click Continue, as shown in Figure 2-57.

    A464567_1_En_2_Fig57_HTML.jpg
    Figure 2-57 Continue to run the flow
  3. Click Run flow, as shown in Figure 2-58.

    A464567_1_En_2_Fig58_HTML.jpg
    Figure 2-58 Run flow
  4. Navigate to Yammer and go to the respective group that was selected as Group ID in the Post message action. You should see a new post in Yammer, as shown in Figure 2-59.

    A464567_1_En_2_Fig59_HTML.jpg
    Figure 2-59 A message posted in Yammer

Thus, in this section, you learned how to create a flow from a SharePoint Online list to post a message to Yammer.

Create a Flow from OneDrive

In this section, you will learn how to create a flow to copy a file from OneDrive for Business to SharePoint.

  1. Navigate to www.office.com . Click the OneDrive app, as shown in Figure 2-60.

    A464567_1_En_2_Fig60_HTML.jpg
    Figure 2-60 The OneDrive app
  2. Click Flow and then click Create flow, as shown in Figure 2-61.

    A464567_1_En_2_Fig61_HTML.jpg
    Figure 2-61 Create a flow
  3. Click See more templates, as shown in Figure 2-62.

    A464567_1_En_2_Fig62_HTML.jpg
    Figure 2-62 The See more templates button
  4. Click the Copy files between OneDrive for Business and SharePoint template shown in Figure 2-63.

    A464567_1_En_2_Fig63_HTML.jpg
    Figure 2-63 Select a template
  5. Sign into OneDrive for Business and SharePoint. Click Continue, as shown in Figure 2-64.

    A464567_1_En_2_Fig64_HTML.jpg
    Figure 2-64 Continue to create the flow
  6. Select the OneDrive folder, SharePoint site address, and SharePoint folder path where the file has to be copied and then click Create Flow, as shown in Figure 2-65.

    A464567_1_En_2_Fig65_HTML.jpg
    Figure 2-65 Update the parameter values to create the flow
  7. The flow has been created successfully. Figure 2-66 shows the details of the newly created flow.

    A464567_1_En_2_Fig66_HTML.jpg
    Figure 2-66 Flow details

To test your flow, perform the following steps:

  1. Navigate to OneDrive and upload a document, as shown in Figure 2-67.

    A464567_1_En_2_Fig67_HTML.jpg
    Figure 2-67 Upload a document to OneDrive
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to the SharePoint folder specified in the flow where the file will be copied and you should see the copied file, as shown in Figure 2-68.

    A464567_1_En_2_Fig68_HTML.jpg
    Figure 2-68 Copied file in SharePoint

Thus, in this section, you learned how to create a flow to copy a file between OneDrive for Business and SharePoint.

Create a Flow in Microsoft Teams

In this section, you will learn how to create a flow to post a message in Microsoft Teams when specific documents are uploaded in SharePoint.

Perform the following steps:

  1. Navigate to Microsoft Teams at https://teams.microsoft.com .

  2. In the left navigation, click Store and then click Flow, as shown in Figure 2-69.

    A464567_1_En_2_Fig69_HTML.jpg
    Figure 2-69 Select the Flow app
  3. Click Install, as shown in Figure 2-70.

    A464567_1_En_2_Fig70_HTML.jpg
    Figure 2-70 Install the Flow app
  4. Open the Flow app, as shown in Figure 2-71.

    A464567_1_En_2_Fig71_HTML.jpg
    Figure 2-71 Open the Flow app
  5. You’ll see four tabs (Conversation, Flows, Approvals, and About). Sign into Flow, as shown in Figure 2-72.

    A464567_1_En_2_Fig72_HTML.jpg
    Figure 2-72 Sign into Flow
  6. Once you sign into Flow, you should see all of your flows. Click Create from template, as shown in Figure 2-73.

    A464567_1_En_2_Fig73_HTML.jpg
    Figure 2-73 Create a flow from a template
  7. Click the Alert the team when specific documents are uploaded template shown in Figure 2-74.

    A464567_1_En_2_Fig74_HTML.jpg
    Figure 2-74 Select a template
  8. Once connected to Microsoft Teams and SharePoint, click Continue, as shown in Figure 2-75.

    A464567_1_En_2_Fig75_HTML.jpg
    Figure 2-75 Continue to create the flow
  9. Go to the When a file is created trigger and fill in the Site Address and Folder Id fields, as shown in Figure 2-76.

    A464567_1_En_2_Fig76_HTML.jpg
    Figure 2-76 Trigger parameters
  10. Go to the Post messageScope condition and check whether the file name contains SharePoint, as shown in Figure 2-77.

    A464567_1_En_2_Fig77_HTML.jpg
    Figure 2-77 Check the condition
  11. If the condition is satisfied, alert the team by posting a message. Go to the Alert the team action and select Team Id and Channel Id. If required, update the default values for the parameters by clicking Edit, as shown in Figure 2-78.

    A464567_1_En_2_Fig78_HTML.jpg
    Figure 2-78 Action parameters
  12. After you’re done with the changes, enter a name for the flow or leave the default name, as shown in Figure 2-79. Click Create Flow.

    A464567_1_En_2_Fig79_HTML.jpg
    Figure 2-79 Save and create a flow
  13. The flow has been created successfully. Click Done, as shown in Figure 2-80.

    A464567_1_En_2_Fig80_HTML.jpg
    Figure 2-80 The flow has been created

To test your flow, perform the following steps:

  1. Navigate to the SharePoint Document Library and upload a document with a file name that contains SharePoint, as shown in Figure 2-81.

    A464567_1_En_2_Fig81_HTML.jpg
    Figure 2-81 Upload a document
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to Microsoft Teams and you should see a new message in the respective team and channel, as shown in Figure 2-82.

    A464567_1_En_2_Fig82_HTML.jpg
    Figure 2-82 Message posted in Microsoft Teams

Thus, in this section, you learned how to create a flow to post a message in Microsoft Teams when specific documents are uploaded in SharePoint.

Send Reminder Emails for Overdue Tasks in SharePoint

A common requirement in SharePoint is to send reminder emails for overdue tasks. You can achieve this using any of the following approaches:

  • SharePoint designer workflow

  • Scheduling console application or PowerShell script

  • Configuring a retention policy or any other approach

In this section, you will learn how to create a flow to send reminder emails for overdue tasks in SharePoint.

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from blank link shown in Figure 2-83.

    A464567_1_En_2_Fig83_HTML.jpg
    Figure 2-83 Create from blank
  3. Click Search hundreds of connectors and triggers, as shown in Figure 2-84.

    A464567_1_En_2_Fig84_HTML.jpg
    Figure 2-84 Search for more connectors
  4. Click the Schedule connector, as shown in Figure 2-85.

    A464567_1_En_2_Fig85_HTML.jpg
    Figure 2-85 Schedule connector
  5. Click the Schedule – Recurrence trigger, as shown in Figure 2-86.

    A464567_1_En_2_Fig86_HTML.jpg
    Figure 2-86 The Schedule – Recurrence trigger
  6. Leave the default interval as 5 minutes, as shown in Figure 2-87, so that you can test it and update the interval in real time based on your requirements.

    A464567_1_En_2_Fig87_HTML.jpg
    Figure 2-87 Recurrence interval
  7. Click Next step and then click Add an action, as shown in Figure 2-88.

    A464567_1_En_2_Fig88_HTML.jpg
    Figure 2-88 Add an action
  8. Type the keyword sharepoint in the search text box and then click the SharePoint - Get items action shown in Figure 2-89.

    A464567_1_En_2_Fig89_HTML.jpg
    Figure 2-89 Select the SharePoint – Get items action
  9. Select the SharePoint site address and list name and then set the filter query with the filter condition of Due Date less than current date (DueDate lt datetime‘@{utcNow()}’), as shown in Figure 2-90.

    Note The tasks list will not be displayed in the List Name drop-down; you need to enter the list name manually by clicking Enter custom value.

    A464567_1_En_2_Fig90_HTML.jpg
    Figure 2-90 Update the parameter values for the Get items action
  10. Click Next step and then click More. Click Add an apply to each, as shown in Figure 2-91.

    A464567_1_En_2_Fig91_HTML.jpg
    Figure 2-91 The Add an apply to each button
  11. Add the dynamic content value from the Get items output to the Select an output from previous steps parameter, as shown in Figure 2-92. Click Add an action.

    A464567_1_En_2_Fig92_HTML.jpg
    Figure 2-92 Add an action
  12. Type office 365 in the search text box and then click the Office 365 – Send an email action shown in Figure 2-93.

    A464567_1_En_2_Fig93_HTML.jpg
    Figure 2-93 Select the Office 365 Outlook – Send an email action
  13. Add static and dynamic content, as shown in Figure 2-94:

    • To: Assigned To Email (dynamic content)

    • Subject: Reminder – Task Overdue – Task Name (dynamic content)

    • Body: Complete the task by today – Task Name (dynamic content) Link to Item (dynamic content)

    Note In the Send an email action, when the dynamic content Assigned To Email is added to the To field, one more loop named Apply to each 2 is automatically added, as shown in Figure 2-94. This is because by default the Assigned To field in the tasks list has Allow multiple selections set to Yes. You can change or check the column settings by navigating to the list settings.

    A464567_1_En_2_Fig94_HTML.jpg
    Figure 2-94 The Send an email action
  14. After you’re done with the changes, enter a name for the flow and click Create Flow, as shown in Figure 2-95.

    A464567_1_En_2_Fig95_HTML.jpg
    Figure 2-95 Save and create the flow
  15. The flow has been created successfully. Click Done, as shown in Figure 2-96.

    A464567_1_En_2_Fig96_HTML.jpg
    Figure 2-96 The flow has been created

    Figure 2-97 shows the details for the newly created flow.

    A464567_1_En_2_Fig97_HTML.jpg
    Figure 2-97 Flow details
  16. To test your flow, look for overdue tasks in the tasks list, as shown in Figure 2-98.

    A464567_1_En_2_Fig98_HTML.jpg
    Figure 2-98 Tasks list
  17. Every 5 minutes, the flow will be executed and will send emails about all overdue tasks, as shown in Figure 2-99.

    A464567_1_En_2_Fig99_HTML.jpg
    Figure 2-99 Overdue tasks emails

Thus, in this section, you learned how to create a flow to send reminder emails for overdue tasks in SharePoint.

Add a Switch Case in a Flow

In this section, you will learn how to use a switch case in a flow. A SharePoint Online custom list named Social Media will be used for this flow. It consists of the following fields (also shown in Figure 2-100):

  • Title (single line of text)

  • Post To (choice)

A464567_1_En_2_Fig100_HTML.jpg
Figure 2-100 Social Media list

A flow will be triggered when a new item is added and it will post a message on Twitter, Yammer, or Facebook based on the Post To field selection in the list item.

Perform the following steps:

  1. Navigate to the Flow site at https://flow.microsoft.com .

  2. In the top navigation, click My flows. Click the Create from blank link, as shown in Figure 2-101.

    A464567_1_En_2_Fig101_HTML.jpg
    Figure 2-101 The Create from blank link
  3. Click Search hundreds of connectors and triggers, as shown in Figure 2-102.

    A464567_1_En_2_Fig102_HTML.jpg
    Figure 2-102 Search for more connectors
  4. Type the keyword sharepoint in the search text box and then click the SharePoint – When an item is created trigger shown in Figure 2-103.

    A464567_1_En_2_Fig103_HTML.jpg
    Figure 2-103 Select the SharePoint – When an item is created action
  5. Select the SharePoint Site Address and List Name, as shown in Figure 2-104.

    A464567_1_En_2_Fig104_HTML.jpg
    Figure 2-104 Action parameters
  6. Click Next step and then click Add a switch case from more options, as shown in Figure 2-105.

    A464567_1_En_2_Fig105_HTML.jpg
    Figure 2-105 Add a switch case
  7. Add the dynamic content Post To Value to the switch case, as shown in Figure 2-106.

    A464567_1_En_2_Fig106_HTML.jpg
    Figure 2-106 Add dynamic content to the switch case
  8. Go to Case, enter the value as Twitter, and then click Add an action, as shown in Figure 2-107.

    A464567_1_En_2_Fig107_HTML.jpg
    Figure 2-107 Case - Twitter
  9. Type the keyword Twitter in the search text box and then click the Twitter – Post a tweet action, as shown in Figure 2-108.

    A464567_1_En_2_Fig108_HTML.jpg
    Figure 2-108 Select the Twitter – Post a tweet action
  10. Add the dynamic content of Title to Tweet text, as shown in Figure 2-109.

    A464567_1_En_2_Fig109_HTML.jpg
    Figure 2-109 The Post a tweet action
  11. Click the + sign to add a case, as shown in Figure 2-110.

    A464567_1_En_2_Fig110_HTML.jpg
    Figure 2-110 Add a case
  12. Go to Case 2, enter the value as Yammer, and then click Add an action, as shown in Figure 2-111.

    A464567_1_En_2_Fig111_HTML.jpg
    Figure 2-111 Case 2 - Yammer
  13. Type the keyword Yammer in the search text box and then click the Yammer – Post Message action shown in Figure 2-112.

    A464567_1_En_2_Fig112_HTML.jpg
    Figure 2-112 Select the Yammer – Post Message action
  14. Select the Group ID and Network ID and then add the dynamic content of Title to Message Text, as shown in Figure 2-113.

    A464567_1_En_2_Fig113_HTML.jpg
    Figure 2-113 The Post Message action
  15. Go to Default and click Add an action, as shown in Figure 2-114.

    A464567_1_En_2_Fig114_HTML.jpg
    Figure 2-114 Add an action
  16. Type the keyword Facebook in the search text box and then click the Facebook – Post to my timeline action shown in Figure 2-115.

    A464567_1_En_2_Fig115_HTML.jpg
    Figure 2-115 Select the Facebook – Post to my timeline action
  17. Add the dynamic content of Title to Status message, as shown in Figure 2-116.

    A464567_1_En_2_Fig116_HTML.jpg
    Figure 2-116 The Post to my timeline action
  18. Enter a name for the flow and then click Create flow, as shown in Figure 2-117.

    A464567_1_En_2_Fig117_HTML.jpg
    Figure 2-117 Create a flow
  19. Figure 2-118 shows the details for the newly created flow.

    A464567_1_En_2_Fig118_HTML.jpg
    Figure 2-118 Flow details

To test your flow, perform the following steps:

  1. Navigate to the SharePoint Online custom list. Create a new item with a message that has to be posted and select the Post To value where it has to be posted. A new item will be created with a message and posted to Twitter, as shown in Figure 2-119.

    A464567_1_En_2_Fig119_HTML.jpg
    Figure 2-119 Create a new item
  2. For this template, the default trigger is every 5 minutes. After 5 minutes, navigate to the Twitter account and you should see a new tweet, as shown in Figure 2-120.

    A464567_1_En_2_Fig120_HTML.jpg
    Figure 2-120 New tweet

Thus, in this section, you learned how to use a switch case in Flow.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset