1. April, 26. – 28. 2021
MICROSOFT 365 VIRTUAL MARATHON 2021
m365virtualmarathon.com #M365VM
Power Automate Techniques that “Saved our Bacon”
Sandra Mahan
Tom Duff
6. Create a Service Account
• Password that doesn't expire
• Allows you to see all your flows in one place
• Flow won't quit running if the person leaves
• Use the service account for the connections
(email, SharePoint list updates)
7. Update Flow Details
Add a description for the flow
• List the business contact, date it was created, and who
created it (especially important if using service account
to know who supports the flow)
Use a naming conventions for your flows
• Site name, List/Library Name , Flow Purpose
8. Rename Actions/Steps
• Retain the action names (optional)
• Indicate what the step does
• Add commenting for more complicated steps
9. Beverage
Update a single column in a
SharePoint list
Chef Tom Riha: https://tomriha.com/update-single-sharepoint-column-in-power-automate-with-http-request/
12. Error Handling
Build a notification when a Power Automate flow fails
Message:
• Expression: workflow()['tags']['flowDisplayName']
• Full Path
13. Monitor and Audit
• Cloud flow activity
• Quickly jump to flow failures
• Power Automate Admin center
• Check for errors on a weekly basis and reach out to the creator
to possibly resolve or delete
• https://admin.powerplatform.microsoft.com/
14. Eggs
Avoid the infinite loop
Chef Scott Shearer: https://o365scott.blog/2019/12/18/stopping-infinite-loops-when-updating-sharepoint-list-items/
15. Trigger Conditions
• Don’t waste flow runs
• Number of API requests / 24 hours based on licensing:
https://docs.microsoft.com/en-us/power-platform/admin/api-request-limits-
allocations#microsoft-power-platform-requests-allocations-based-on-licenses
• Difficult to figure out if the flow actually did anything if
they run every time with no actions
• Allows you to avoid runs entirely instead of using
condition actions to check and terminate
17. HTML Link in Email
• Manually create your link with your <a> tag (use single
quotes around the actual link)
• Add a <div> at the top and a </div> at the bottom to
keep the email from going back to WYSIWYG mode (and
corrupting the link)
19. Multi-Value Choice Fields
• You’d think you could update a multi-value field like the
illustration on the left… and you’d be wrong.
• Instead, you have to format each of the values in the
multi-value field into an Array variable, and then put
the array variable into the field in the Update action.
20. Multi-Value Choice Fields
• You need to create your Array variable.
• For each of the values in the multi-value field (Apply to
each action), add an element using brackets to separate
each value.
21. Multi-Value Choice Fields
• Once all the elements are loaded into the Array
variable, collapse the field in the Update Item action
and add the Array variable to the field.
Again, I *highly* stress that you check out Laura Roger’s
post on this topic:
https://wonderlaura.com/2020/09/01/flow-update-multi-
select-column/
22. Cereal and Fruit
How to get a number of items to
process in your flow by using the
Get Items action
Chef Andrew Chomik: https://blog.ion.works/2019/03/17/common-odata-filters-for-microsoft-flow-a-reference-chart-for-users-of-all-kinds/
23. Filter Queries
• Filter Query – create a query to select all the items you
want (Status is equal to ‘Notifications In Process’ and
First Notification Date is equal to today)
• Order By – sort the results (Title asc, Date desc)
• Top Count – it says “Default = all”… that’s a lie. 100 is
the default, and the most you can have is 5000.
• Limit Columns by View – uses the default view of the
list. However, if you exceed thresholds in the default
view, you’ll need to create a different view with only
the fields you need and use that view here.
24. BACON!!!!
How to manipulate permissions
on SharePoint list items...
(Honestly, this is where I miss SharePoint Designer the
most...)
25. Restoring Inheritance
• Necessary if your list item already has unique
permissions, and it must be the first thing you do.
• URI of API call:
_api/lists/getByTitle('<list>')/items(<item ID>)/resetroleinheritance()
26. Breaking Inheritance
• URI of API call:
_api/lists/getByTitle('<list>')/items(<item
ID>)/breakroleinheritance(copyRoleAssignments=false,clearSubscopes=
true)
• copyRoleAssigments – true to copy over
existing permissions, false to start with no permissions
• clearSubscopes – true to set any child items to
inherit from this item, false to leave the child items
alone
27. Group Permissions
• getByName – the name of the SharePoint permission
group you want to use
• URI of API call:
/_api/web/SiteGroups/GetByName('<name of permission group>')
28. Group Permissions
• d.id – this grabs the ID of the SharePoint permission
group from the previous step.
• Enter the following in the Expressions tab:
body('Send_an_HTTP_request_to_xxxx_Owners')['d']['id']
29. Group Permissions
• getByTitle – the name of the list where the item resides
• items – the item ID
• addroleassignment – the ID from the previous step
• roledefid – the value of the permission level, such as
Full Control (more on that in a couple of slides)
30. Person Permissions
• getByEmail – the email address of the person who will
be added to the permissions (the Outputs action will be
explained in a later slide)
• URI of API call:
/_api/web/SiteUsers/GetByEmail('<user email address>')
31. Person Permissions
• d.id – this grabs the ID of the person from the previous
step.
• Enter the following in the Expressions tab:
body('Send_an_HTTP_request_to_Employee_ID_Email')['d']['id']
32. Person Permissions
• getByTitle – the name of the list where the item resides
• items – the item ID
• addroleassignment – the ID from the previous step
• roledefid – the value of the permission level, such as
Full Control (more on that in a couple of slides)
33. How to find the
roledefinition values
• Type the following into your browser:
https://domain/sites/sitename/_api/web/roledefinitions
• All the role definition values show up in the XML page…
you just have to find them. ☺
• Default Role Definitions:
Role Definition Name Role Definition Id
Full Control 1073741829
Design 1073741828
Edit 1073741830
Contribute 1073741827
Read 1073741826
Limited Access 1073741825
View Only 1073741924
Chef Md. Tahmidul Abedin: https://www.c-sharpcorner.com/article/get-sharepoint-role-definition-ids/
34. Use an XML format tool
• <d.Name> - the name of the permission level
• <d.Id> - the numeric value of the permission level
• I recommend always looking them up…
35. Be sure to tip your waiters
Tom Duff
• Twitter - @duffbert
• Website - https://oneminuteofficemagic.com
• LinkedIn - https://www.linkedin.com/in/thomasduff/
• Email - duffbert@gmail.com
Sandra Mahan
• Twitter - @smahan14
• LinkedIn - https://www.linkedin.com/in/sharepointsandra/
• Email – smahan14@gmail.com
• Questions and Answers
• Complete session feedback -
http://bit.ly/M365VM21Feedback
37. Accommodating apostrophes
in an email address
• Apostrophes in email addresses are technically invalid,
but they will still route.
• However, it completely messes up the getByEmail REST
API call when trying to set permissions.
• To work around this, you need to “escape” the single
apostrophe in a Compose action
• Use the following Expression:
replace(body('Get_user_profile_(V2)')?['Mail'], '''', '''''')
38. What if the person is new?
This adds the person to a SharePoint permission group in
the site so that their ID can be found in the Site Collection
User List.
URI of API call:
_api/web/SiteGroups/GetByName('Preload Users')/users
Body of API call:
{
"__metadata": {
"type":"SP.User"
},
"LoginName":"i:0#.f|membership|bob@test.com"
}