Skip to main content

Build an Overtime Timesheet App in Power Apps — Part 19: Set SharePoint Permissions from the Setup Flow

· 32 min read
Jagdish Kumawat
Founder @ Dewiride

Part 3 locked down the Overtime Timesheet app's SharePoint site by hand: a permission level without delete, the staff group in Visitors, and lists with their own permissions, own-entries-only and content approval. This part adds all of it to the setup flow from Part 18, so a new site gets the same protection in one run, and a second run changes nothing.

This is Part 19 of a 22-part series.

  1. Part 1: Plan the App and Set Up the Demo Organization
  2. Part 2: Create the SharePoint Site and Lists
  3. Part 3: Keep Overtime Private with SharePoint Permissions
  4. Part 4: Create the Solution, Environment Variables and Canvas App
  5. Part 5: Build the Home Screen
  6. Part 6: Build the Log Overtime Screen
  7. Part 7: Build the My Overtime Screen
  8. Part 8: Build the Approval Flow for Teams and Outlook
  9. Part 9: Show Approvers What's Waiting
  10. Part 10: Build the Departments Screen
  11. Part 11: Build the Reports Screen
  12. Part 12: Import the Old Excel Timesheet
  13. Part 13: Create the Monthly Payroll Workbook with Office Scripts
  14. Part 14: Create the Payroll Workbook from the App
  15. Part 15: Build the Power BI Overtime Report
  16. Part 16: Share the App and Add It to Microsoft Teams
  17. Part 17: Manage Joiners, Movers and Leavers
  18. Part 18: Build a Setup Flow That Creates the Lists
  19. Part 19: Set SharePoint Permissions from the Setup Flow (you are here)
  20. Part 20: Run the Solution Checker and Export the Solutions (coming soon)
  21. Part 21: Install the App in a New Environment (coming soon)
  22. Part 22: Recap, Production Checklist and Next Steps (coming soon)

After Part 18, the Set Up Overtime Timesheet flow creates the app's lists and library on any site, but anyone with access to the site could still open every entry. The privacy the app promises comes from SharePoint's permissions, which Part 3 set by hand and Part 5 extended to the Settings list. This part adds those permissions to the same flow, tests it on the test site from Part 18, and compares the result with the app's own site.

What You'll Build​

The new steps come after If the Setup folder is missing, the last step from Part 18:

  1. Find the permission level, then If the permission level is missing, with Create the permission level in its True branch: the Contribute Without Delete level from Part 3.
  2. Get the site groups: the IDs of the site's Members and Visitors groups.
  3. Add the users group to Visitors: everyone in Overtime Timesheet Users can read the site.
  4. Permission definitions (Compose): what each list gets, as JSON.
  5. For each permission (Apply to each), for each list:
    1. Check the list permissions, then If the list inherits permissions: stop inheriting, remove the Members group, and remove the Visitors group where it should go.
    2. If the list has a group to add: add the group to the site, read the level's ID, and give the group that level on the list.
    3. If people see only their own items: turn on item-level permissions.
    4. If entries need approval: turn on content approval.

The new steps, with the conditions collapsed:

The new steps in the designer: Find the permission level, If the permission level is missing with 2 Cases, Get the site groups, Add the users group to Visitors, Permission definitions, and For each permission with 5 Actions

How It Works​

  • The permissions are data. One JSON array, Permission definitions, says what each list gets: which group, which level, whether Visitors stays, own items only and content approval. The loop reads it, the same way Part 18's flow reads its list definitions.
  • Every change looks first. The level is created only when it's missing. A list stops inheriting, and loses the site's groups, only while it still inherits, so a second run never removes anything you've added since.
  • Groups come from Microsoft Entra. The trigger already asks for the payroll and admins groups' Object IDs; it gets a fourth input for Overtime Timesheet Users. SharePoint names a security group c:0t.c|tenant| followed by its Object ID, the form SharePoint itself shows for these groups.
  • REST requests, standard licences. Every step is Send an HTTP request to SharePoint from the standard SharePoint connector, with the flow's connection reference from Part 18, so it costs nothing extra.
  • What stays manual. Nothing in Part 3's design. The flow reproduces all of it, on any site, from four inputs.

Prerequisites​

Step 1: Add the Users Group Input​

Open Set Up Overtime Timesheet from Power Automate's Solutions page: the Overtime Timesheet Setup solution, then the flow, then Edit. In the trigger, add a fourth Text input (How to Add a Text Input to a Manually Triggered Flow in Power Automate):

InputDescriptionIn expressions
Users group IDThe Object ID of the group of all your app users in Microsoft Entra, such as Overtime Timesheet UserstriggerBody()?['text_3']

The Manually trigger a flow trigger with four inputs: Site URL, Payroll group ID, Admins group ID and Users group ID, each with its description

It's the trigger's fourth text input, so its key is text_3.

Step 2: Create the Permission Level Once​

Part 3 copied Contribute and cleared Delete Items and Delete Versions. The flow does the same with numbers: a level's permissions travel as two numbers, High and Low, and Contribute is High 432 and Low 1011028719. Delete Items is worth 8 in Low and Delete Versions 128, so Contribute Without Delete is Low 1011028719 − 136 = 1011028583, with High 432. How to Create a SharePoint Permission Level with the REST API in Power Automate explains where those values come from. I read the app's own level from Part 3 with the same REST request as How to See a SharePoint Permission Level's Permissions in the Browser, and it had exactly these two numbers.

After If the Setup folder is missing, add Send an HTTP request to SharePoint and rename it Find the permission level:

FieldValue
Site AddressSite URL from the trigger
MethodGET
Uri_api/web/roledefinitions?$filter=Name eq 'Contribute Without Delete'&$select=Id
HeadersAccept: application/json;odata=nometadata

The Find the permission level action with Site Address set to the Site URL token, Method GET, the Uri _api/web/roledefinitions?$filter=Name eq 'Contribute Without Delete'&$select=Id and the Accept header

Then a Condition called If the permission level is missing: this expression on the left, is equal to, and the expression true on the right. empty() is true when the answer's list of matching levels has nothing in it:

If the permission level is missing → left value
empty(body('Find_the_permission_level')?['value'])

The If the permission level is missing condition with an empty(...) expression token on the left, is equal to, and a true expression token on the right

In its True branch, add Create the permission level:

FieldValue
Site AddressSite URL
MethodPOST
Uri_api/web/roledefinitions
HeadersAccept: application/json;odata=nometadata
Content-Type: application/json;odata=verbose
Create the permission level → Body
{
"__metadata": { "type": "SP.RoleDefinition" },
"Name": "Contribute Without Delete",
"Description": "Can view, add, and update list items and documents, but not delete them.",
"BasePermissions": {
"__metadata": { "type": "SP.BasePermissions" },
"High": "432",
"Low": "1011028583"
}
}

The Create the permission level action with Method POST, the Uri _api/web/roledefinitions, the Accept and Content-Type headers, and the Body with Name Contribute Without Delete, Part 3's description, and BasePermissions High 432 and Low 1011028583

The name and description are Part 3's, word for word, so the level looks the same on every site.

Step 3: Read the Site's Groups​

The lists start with a copy of the site's permissions, and two of the site's own groups have to come off some lists. The flow reads their IDs from the site instead of assuming them. After the condition, add Get the site groups:

FieldValue
Site AddressSite URL
MethodGET
Uri_api/web?$select=AssociatedMemberGroup/Id,AssociatedVisitorGroup/Id&$expand=AssociatedMemberGroup,AssociatedVisitorGroup
HeadersAccept: application/json;odata=nometadata

The Get the site groups action with Method GET, the Uri _api/web?$select=AssociatedMemberGroup/Id,AssociatedVisitorGroup/Id&$expand=AssociatedMemberGroup,AssociatedVisitorGroup and the Accept header

AssociatedMemberGroup and AssociatedVisitorGroup are the site's own Members and Visitors groups. $expand brings each group into the answer, and $select keeps only its Id. On the test site, they were 5 and 4. Later steps read them with these expressions:

The Members group's ID
body('Get_the_site_groups')?['AssociatedMemberGroup']?['Id']
The Visitors group's ID
body('Get_the_site_groups')?['AssociatedVisitorGroup']?['Id']

Step 4: Put the Users Group in Visitors​

Part 3 shared the site with Overtime Timesheet Users at Read, which put the security group in the site's Visitors group. The flow adds it there directly (How to Add a Security Group to a SharePoint Group with the REST API in Power Automate). Add Add the users group to Visitors:

FieldValue
Site AddressSite URL
MethodPOST
Uri_api/web/associatedvisitorgroup/users
HeadersAccept: application/json;odata=nometadata
Content-Type: application/json;odata=verbose

In Body, type the JSON and put Users group ID from the trigger right after tenant|. The fourth input sits behind See more in the trigger's dynamic content:

Add the users group to Visitors → Body
{
"__metadata": { "type": "SP.User" },
"LoginName": "c:0t.c|tenant|@{triggerBody()?['text_3']}"
}

The Add the users group to Visitors action with Method POST, the Uri _api/web/associatedvisitorgroup/users, the Accept and Content-Type headers, and the Body with type SP.User and LoginName c:0t.c|tenant| followed by the Users group ID token

Microsoft documents the login name of a Microsoft 365 group, but I found no page for a security group's. c:0t.c|tenant|<Object ID> is what the app's own site showed for Overtime Timesheet Users in its users, and what SharePoint's Check Permissions shows in Step 12.

Step 5: Describe Each List's Permissions​

Add a Compose action called Permission definitions (How to Use the Compose Action in Power Automate). Type the JSON, and put each group ID token from the trigger between the quotes after "groupId"::

A macOS-style code window titled Permission definitions → Inputs, showing the JSON array with four entries: Departments, OvertimeEntries, Settings and Payroll Exports, each with removeVisitors, groupId, level, ownItemsOnly and contentApproval

Permission definitions → Inputs
[
{
"list": "Departments",
"removeVisitors": false,
"groupId": "@{triggerBody()?['text_2']}",
"level": "Contribute Without Delete",
"ownItemsOnly": false,
"contentApproval": false
},
{
"list": "OvertimeEntries",
"removeVisitors": true,
"groupId": "@{triggerBody()?['text_3']}",
"level": "Contribute Without Delete",
"ownItemsOnly": true,
"contentApproval": true
},
{
"list": "Settings",
"removeVisitors": false,
"groupId": "",
"level": "",
"ownItemsOnly": false,
"contentApproval": false
},
{
"list": "Payroll Exports",
"removeVisitors": true,
"groupId": "@{triggerBody()?['text_1']}",
"level": "Read",
"ownItemsOnly": false,
"contentApproval": false
}
]

The designer shows the three group IDs as tokens:

The Permission definitions Compose action with the JSON array in Inputs and the Admins group ID, Users group ID and Payroll group ID tokens inside the groupId values

Each entry is one of Part 3's steps, or Part 5's for Settings:

KeyWhat it meansWhere it comes from
listThe list or libraryPart 18's lists
removeVisitorsTake the site's Visitors group off this list too. Members always comes off.Part 3 kept Visitors on Departments and Part 5 on Settings, so staff can read them
groupIdThe security group to add, or "" for noneAdmins, Users or Payroll group ID
levelThe level that group getsContribute Without Delete for admins and staff, Read for payroll
ownItemsOnlyPeople see and edit only their own itemsOvertimeEntries only
contentApprovalNew and edited items wait for approvalOvertimeEntries only

Step 6: Loop Over the Lists​

Add an Apply to each called For each permission over Outputs of Permission definitions (How to Loop Through an Array with Apply to Each in Power Automate):

The For each permission loop with the Permission definitions output selected under Select an output from previous steps

Inside the loop, every step reads the current entry with items('For_each_permission'), such as this for the list's name:

The current list's name
items('For_each_permission')?['list']

The loop holds one request and four conditions:

The For each permission loop expanded, with Check the list permissions followed by four collapsed conditions with 2 Cases each: If the list inherits permissions, If the list has a group to add, If people see only their own items and If entries need approval

The first is Check the list permissions, which asks whether the list still inherits its site's permissions:

FieldValue
Site AddressSite URL
MethodGET
Uri_api/web/lists/getbytitle(' list ')?$select=HasUniqueRoleAssignments
HeadersAccept: application/json;odata=nometadata

The Check the list permissions action with the Uri _api/web/lists/getbytitle(' followed by a list token and ')?$select=HasUniqueRoleAssignments

Step 7: Stop Inheriting and Remove the Site's Groups​

Add a Condition called If the list inherits permissions: this expression on the left, is equal to, and the expression false on the right:

If the list inherits permissions → left value
body('Check_the_list_permissions')?['HasUniqueRoleAssignments']

The If the list inherits permissions condition with a HasUniqueRole... token on the left, is equal to, and a false expression token on the right

Its True branch does what Part 3 did first on each list:

The True branch of If the list inherits permissions with Stop inheriting permissions, Remove Members, and If Visitors should go with Remove Visitors in its True branch; both False branches are empty

Stop inheriting permissions copies the site's permissions to the list (How to Stop Inheriting Permissions on a SharePoint List with the REST API in Power Automate):

FieldValue
MethodPOST
Uri_api/web/lists/getbytitle(' list ')/breakroleinheritance(copyroleassignments=true,clearsubscopes=true)
HeadersAccept: application/json;odata=nometadata

The Stop inheriting permissions action with Method POST and the Uri _api/web/lists/getbytitle(' with a list token and ')/breakroleinheritance(copyroleassignments=true,clearsubscopes=true)

Remove Members deletes the Members group's role assignment on the list, with the Members ID from Step 3 inside getbyprincipalid( ) (How to Remove a Group's Permissions from a SharePoint List with the REST API in Power Automate):

FieldValue
MethodPOST
Uri_api/web/lists/getbytitle(' list ')/roleassignments/getbyprincipalid( AssociatedMemberGroup Id )
HeadersAccept: application/json;odata=nometadata
X-HTTP-Method: DELETE

The Remove Members action with Method POST, the Uri _api/web/lists/getbytitle(' with a list token, ')/roleassignments/getbyprincipalid( with an AssociatedMem... token and a closing bracket, and the headers Accept and X-HTTP-Method DELETE

Then a Condition called If Visitors should go, with items('For_each_permission')?['removeVisitors'] on the left, is equal to, and the expression true on the right. In its True branch, Remove Visitors is the same request with the Visitors ID:

The Remove Visitors action with the same Uri as Remove Members but an AssociatedVisito... token inside getbyprincipalid, and the headers Accept and X-HTTP-Method DELETE

All of this sits inside If the list inherits permissions on purpose. Once a list has its own permissions, the flow leaves the groups on it alone.

Step 8: Give Each List Its Group​

After that condition, still in the loop, add a Condition called If the list has a group to add: this expression on the left, is equal to, and the expression false on the right. Settings has no group, so it skips this branch:

If the list has a group to add → left value
empty(items('For_each_permission')?['groupId'])

Its True branch has three requests (How to Give a Group Access to a SharePoint List with the REST API in Power Automate):

The True branch of If the list has a group to add with Add the group to the site, Get the permission level and Give the group access; the False branch is empty

Add the group to the site turns the security group into a SharePoint ID on this site:

FieldValue
MethodPOST
Uri_api/web/ensureuser
HeadersAccept: application/json;odata=nometadata
Content-Type: application/json;odata=verbose
Add the group to the site → Body
{
"logonName": "c:0t.c|tenant|@{items('For_each_permission')?['groupId']}"
}

The Add the group to the site action with Method POST, the Uri _api/web/ensureuser, the Accept and Content-Type headers, and the Body with logonName c:0t.c|tenant| followed by a groupId token

Get the permission level reads the level's ID by its name from the definitions:

FieldValue
MethodGET
Uri_api/web/roledefinitions/getbyname(' level ')?$select=Id
HeadersAccept: application/json;odata=nometadata

The Get the permission level action with Method GET and the Uri _api/web/roledefinitions/getbyname(' with a level token and ')?$select=Id

Give the group access assigns that level to the group on the list:

FieldValue
MethodPOST
Uri_api/web/lists/getbytitle(' list ')/roleassignments/addroleassignment(principalid= Id ,roledefid= Id )
HeadersAccept: application/json;odata=nometadata
principalid and roledefid
body('Add_the_group_to_the_site')?['Id']
body('Get_the_permission_level')?['Id']

The Give the group access action with Method POST and the Uri _api/web/lists/getbytitle(' with a list token, ')/roleassignments/addroleassignment(principalid= with an Id token, ,roledefid= with another Id token, and a closing bracket

Step 9: Own Items Only and Content Approval​

Two more conditions finish the loop, each with one request in its True branch. Both requests are MERGEs on the list, with the headers Accept: application/json;odata=nometadata, Content-Type: application/json;odata=verbose, IF-MATCH: * and X-HTTP-Method: MERGE, and the Uri _api/web/lists/getbytitle(' list ').

If people see only their own items checks items('For_each_permission')?['ownItemsOnly'] against the expression true. Its Let people see only their own items sets Part 3's item-level permissions (How to Let Users See Only Their Own Items in a SharePoint List with the REST API in Power Automate):

Let people see only their own items → Body
{
"__metadata": { "type": "SP.List" },
"ReadSecurity": 2,
"WriteSecurity": 2
}

The Let people see only their own items action with Method POST, the Uri _api/web/lists/getbytitle(' with a list token and '), the headers Accept, Content-Type, IF-MATCH * and X-HTTP-Method MERGE, and the Body with type SP.List, ReadSecurity 2 and WriteSecurity 2

If entries need approval checks items('For_each_permission')?['contentApproval'] against the expression true. Its Turn on content approval sets Part 3's versioning settings (How to Turn On Content Approval for a SharePoint List with the REST API in Power Automate):

Turn on content approval → Body
{
"__metadata": { "type": "SP.List" },
"EnableModeration": true,
"DraftVersionVisibility": 2
}

The Turn on content approval action with the same Uri and headers, and the Body with type SP.List, EnableModeration true and DraftVersionVisibility 2

These two run on every pass that asks for them, not only the first: they set a value, so setting it again changes nothing.

Step 10: Run It on the Test Site​

Save the flow, then Test > Manually, which asks to Publish & Test (How to Save a Draft and Publish a Flow in Power Automate). I typed the test site's address and pasted the three group IDs, each copied in Microsoft Entra with Copy object ID to clipboard (How to Find a Group's Object ID in Microsoft Entra). The IDs are hidden in the picture:

The Run flow panel of Set Up Overtime Timesheet with Site URL https://contoso.sharepoint.com/sites/OvertimeTimesheetTest and the Payroll, Admins and Users group IDs hidden as 00000000-0000-0000-0000-000000000000, each with its description, above Run flow and Cancel

The run succeeded in 22 seconds. In the run, the loop's arrows step through its four passes. Pass 2 of 4, OvertimeEntries, stopped inheriting and removed both of the site's groups:

Pass 2 of 4 of For each permission in the first run, with green ticks on Check the list permissions, If the list inherits permissions and, in its True branch, Stop inheriting permissions, Remove Members, If Visitors should go and Remove Visitors

The same pass gave Overtime Timesheet Users its level and turned on both list settings:

Pass 2 of 4 further down, with green ticks on Add the group to the site, Get the permission level and Give the group access, then Let people see only their own items and Turn on content approval in their True branches

Step 11: Run It Again​

I repeated the run with Test > Automatically > With a recently used trigger (How to Rerun a Cloud Flow with the Same Inputs in Power Automate). As in Part 18, the newest run in that list said Test Running although it had finished; selecting it still reused its inputs. The level was found, so Create the permission level was skipped:

The repeat run with Find the permission level and If the permission level is missing succeeded, and Create the permission level in the True branch showing a grey skipped sign

Every list already had its own permissions, so the whole True branch of If the list inherits permissions was skipped too:

Pass 2 of 4 of the repeat run, with Check the list permissions and If the list inherits permissions succeeded, and Stop inheriting permissions, Remove Members, If Visitors should go and Remove Visitors all skipped

The other requests ran again without an error and without duplicates: posting Overtime Timesheet Users to Visitors again, ensureuser and addroleassignment for a group that already had its level. Afterwards, the site still had seven permission levels, one member in Visitors and the same groups on each list. The run history shows both runs after Part 18's four (How to See a Flow's Run History in Power Automate):

The flow's 28-day run history with six runs: Nov 26 at 04:25 AM taking 00:00:21 and 04:23 AM taking 00:00:22, then Part 18's four runs on Nov 25, all Test succeeded

Step 12: Check the Result in SharePoint​

On the test site, Site settings > Site permissions shows the site's three groups, and a warning that some content has different permissions:

The test site's permissions page with the warnings Some content on this site has different permissions from what you see here and There are limited access users on this site, above Overtime Timesheet Test Members with Edit, Owners with Full Control and Visitors with Read

Show these items lists the four lists and libraries that now have their own permissions (How to See Which Lists Have Unique Permissions in SharePoint):

The Exceptions dialog for Overtime Timesheet Test listing Departments, OvertimeEntries, Payroll Exports and Settings under Lists that have unique permissions, each with a manage permissions link

Each list's permissions page, List settings > Permissions for this list, has exactly Part 3's groups. OvertimeEntries: the owners and Overtime Timesheet Users, a Domain Group, with Contribute Without Delete:

The OvertimeEntries permissions page with This list has unique permissions, Overtime Timesheet Test Owners with Full Control and Overtime Timesheet Users, a Domain Group, with Contribute Without Delete

Departments: Overtime Admins with Contribute Without Delete, and Visitors kept at Read:

The Departments permissions page with Overtime Admins, a Domain Group, with Contribute Without Delete, Overtime Timesheet Test Owners with Full Control and Overtime Timesheet Test Visitors with Read

Payroll Exports: Overtime Payroll with Read, and the owners:

The Payroll Exports permissions page with This library has unique permissions, Overtime Payroll, a Domain Group, with Read and Overtime Timesheet Test Owners with Full Control

Settings: the owners and Visitors, as Part 5 left it:

The Settings permissions page with This list has unique permissions, Overtime Timesheet Test Owners with Full Control and Overtime Timesheet Test Visitors with Read

Permission Levels has the new level, with Part 3's description:

The Permission Levels page listing Full Control, Design, Edit, Contribute, Read and, boxed in red, Contribute Without Delete with the description Can view, add, and update list items and documents, but not delete them.

People and groups > Overtime Timesheet Test Visitors has Overtime Timesheet Users as its member:

The People and Groups page of Overtime Timesheet Test Visitors with one member, Overtime Timesheet Users

OvertimeEntries > Advanced settings has both item-level settings, and Versioning settings has content approval, with drafts shown only to approvers and authors:

The Item-level Permissions section of OvertimeEntries with Read items that were created by the user and Create items and edit items that were created by the user selected and boxed in red

The Versioning settings of OvertimeEntries with Require content approval for submitted items set to Yes and Only users who can approve items (and the author of the item) selected, both boxed in red, and 50 versions kept

I left each settings page with Cancel, so nothing was saved from them. Last, Check Permissions on OvertimeEntries for Aisha (How to Check a User's Permissions in SharePoint) shows the level she gets through the users group, and SharePoint's own name for that group:

The OvertimeEntries Check Permissions dialog for Aisha Khan showing Contribute Without Delete, Given through the Overtime Timesheet Users group, with the group's login name c:0t.c|tenant| followed by its Object ID, hidden as zeros

Step 13: Compare with Part 3​

I compared the test site with the app's own site through the REST API, reading the app's site only:

WhatResult
Contribute Without DeleteThe same High and Low, name and description, and the same place at the end of the list
VisitorsOvertime Timesheet Users on both, as a security group
DepartmentsOwners Full Control, Visitors Read, Overtime Admins Contribute Without Delete on both
OvertimeEntriesOwners Full Control and Overtime Timesheet Users Contribute Without Delete, own items only, content approval with drafts for approvers and authors, 50 versions, on both
SettingsOwners Full Control and Visitors Read on both
Payroll ExportsOwners Full Control and Overtime Payroll Read on both
Views of OvertimeEntriesTurning on content approval by REST added the Approval Status column to the default view and the Approve/reject Items and My submissions views, as Part 3's switch did. The only difference is the By month view, which Part 7 made by hand and the app doesn't use

With Part 18's lists and this part's permissions, the setup flow now rebuilds everything Parts 2, 3 and 5 did by hand on the SharePoint site.

The Problems I Hit​

  • A bracket in the wrong place. In my first Remove Members, the closing bracket after the group's ID ended up inside the expression instead of after it. The action's Code view showed it. I retyped the Uri, and from then on checked every Uri with a token in Code view before running.
  • The fourth input was hidden in dynamic content. Users group ID appeared only after See more in the trigger's list of values.
  • The repeat's run list said Test Running for a finished run, as in Part 18. Selecting it still reused its inputs.

The first was my own mistake, and the other two are how the designer behaves, so none needed a fixes post.

Common Mistakes​

MistakeWhat happensDo this instead
Running it on the app's real site to testThe flow changes the real site's permissionsTest on the empty site from Part 18
Typing the level's numbers by hand from memoryOne wrong bit gives the level a permission you didn't meanRead Contribute in the browser and take 136 away
Pasting the wrong group's Object IDThe wrong people get access to a listCopy each ID from the right group's Overview
Leaving the removals outside If the list inherits permissionsA rerun would remove groups from lists you've changed sinceKeep them in its True branch
A security group's display name in logonNameThe login name is built from the Object ID, not the nameUse c:0t.c|tenant| and the Object ID
Removing Visitors from DepartmentsStaff can't read the departments the app's picker listsKeep removeVisitors false for it

Troubleshooting​

SymptomLikely causeFix
Create the permission level failsThe connection's account isn't a site ownerUse an account with Full Control of the site
Add the users group to Visitors or Add the group to the site failsA group ID is wrong or incompleteCopy it again in Microsoft Entra and rerun
Get the permission level failsThe level in the definitions doesn't match a level's nameUse the exact name from Permission Levels
A list still shows the site's MembersThe list already had its own permissions before the first runRemove the group on that list by hand, or use a fresh site
Staff see each other's entriesThe users group has a level with Override List BehaviorsGive it Contribute Without Delete only

FAQ​

Can I run it on the site from Part 3?​

I ran it only on the test site. On a site where Part 3 is already done, every list already has its own permissions, so the removals would be skipped, and the other requests set what's already there. That's what the repeat run in Step 11 did on the test site.

What if someone changes a list's permissions later?​

A rerun puts back what the definitions ask for and leaves everything else. A list with its own permissions skips the stop-and-remove steps, so groups someone added stay. The definitions' group gets its level again if it lost it, and own items only and content approval are set again on OvertimeEntries.

Why not use SharePoint groups of my own?​

The security groups from Part 1 already hold the right people, and Microsoft Entra is where joiners and leavers are handled (Part 17). Adding them to SharePoint directly keeps one place to change membership.

Does the flow need more licences?​

No. Every step uses the standard SharePoint connector, which Microsoft 365 licences include.

Conclusion​

The Set Up Overtime Timesheet flow now sets Part 3's permissions as well as Part 2's lists:

  • the Contribute Without Delete level, created once from Contribute's numbers;
  • Overtime Timesheet Users in the site's Visitors group;
  • each list's own permissions from one JSON description: the site's Members off every list, Visitors off OvertimeEntries and Payroll Exports, and the right group at the right level;
  • own items only and content approval on OvertimeEntries.

A second run skips everything already done. Part 20 runs the solution checker on both solutions and exports them, ready to install somewhere new.

Additional Resources​

← Previous: Part 18: Build a Setup Flow That Creates the Lists Next → Part 20: Run the Solution Checker and Export the Solutions (coming soon)