We have users that come and go from our department often, however the job roles stay the same and it simply gets passed from person to person. I'm hoping to automate the process of adding people to a temporary SharePoint permissions group using their name and once they have been assigned the role of their predecessor they will automatically be removed from the SharePoint group.
I've already mostly planned the flow that will add the users to the temporary group by having users fill out an arrivals form before they start the job, the flow will grab the user's details and add them to the permissions group using a HTTP POST request.
The flow I'm planning to create to remove users looks at a SharePoint Permission Group (or multiple) and compares a user's job title with a job role in the SharePoint Group. In example a user would look like 'John Doe (IT_TECH1)' and the job role in the permission group would just be IT_TECH1.
The flow would ideally check the user's job title, check all permission groups to see if a role of the same type exists and if it does it will remove the user. The user themselves will be unaffected by this change as they will inherit all of their permissions from the job role permissions anyway.
The idea behind this is to try and automate the process of adding and removing users using the HTTP GET and POST requests.
I'm using these two documents as reference:
How to add permissions to SharePoint group with Power Automate (tomriha.com)
Remove user from a SharePoint group with Power Automate flow (tomriha.com)
Apart from having the flow run on a monthly or two weekly schedule I have no idea how to even start this flow, let alone how to compare people's job titles with job roles across permission groups!!
Is this even possible and how would I go about it?
Any help would be greatly appreciated!!
Cheers,
Ry
So. I've made some progress.
I'm able to get the data I need from my two test permission groups using the 'Send an HTTP request to SharePoint' action.
I've currently got two parallel actions that use the GET method to get the user data from two different permission groups with the below Uri:
_api/web/sitegroups(19194)/users
This gets all the user data from the specified permission group and the output looks as below (personal details replaced)
{
"d": {
"results": [
{
"__metadata": {
"id": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(5447)",
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(5447)",
"type": "SP.User"
},
"Alerts": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(5447)/Alerts"
}
},
"Groups": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(5447)/Groups"
}
},
"Id": 5447,
"IsHiddenInUI": false,
"LoginName": "i:0#.f|membership|(user email)",
"Title": "Doe, John (TECH_1)",
"PrincipalType": 1,
"Email": "(user email)",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": {
"__metadata": {
"type": "SP.UserIdInfo"
},
"NameId": "10032000a0f46068",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "(user email)"
},
{
"__metadata": {
"id": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(2916)",
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(2916)",
"type": "SP.User"
},
"Alerts": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(2916)/Alerts"
}
},
"Groups": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(2916)/Groups"
}
},
"Id": 2916,
"IsHiddenInUI": false,
"LoginName": "i:0#.f|membership|(user email)",
"Title": "Doe, Jack (TECH_BOSS)",
"PrincipalType": 1,
"Email": "(user email)",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": {
"__metadata": {
"type": "SP.UserIdInfo"
},
"NameId": "100320016aeb9c38",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "(user email)"
},
{
"__metadata": {
"id": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(12467)",
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(12467)",
"type": "SP.User"
},
"Alerts": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(12467)/Alerts"
}
},
"Groups": {
"__deferred": {
"uri": "https://(sharepointURL)/teams/(teamsnumber)/_api/Web/GetUserById(12467)/Groups"
}
},
"Id": 12467,
"IsHiddenInUI": false,
"LoginName": "i:0#.f|membership|(user email)",
"Title": "Doe, James (TECH_2)",
"PrincipalType": 1,
"Email": "(user email)",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": {
"__metadata": {
"type": "SP.UserIdInfo"
},
"NameId": "1004200040379619",
"NameIdIssuer": "urn:federation:microsoftonline"
},
"UserPrincipalName": "(user email)"
}
]
}
}
and
{
"d": {
"results": [
{
"__metadata": {
"id": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9840)",
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9840)",
"type": "SP.User"
},
"Alerts": {
"__deferred": {
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9840)/Alerts"
}
},
"Groups": {
"__deferred": {
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9840)/Groups"
}
},
"Id": 9840,
"IsHiddenInUI": false,
"LoginName": "c:0t.c|tenant|0e130255-5413-4d94-941b-510e7ceb33b1",
"Title": "TECH_1",
"PrincipalType": 4,
"Email": "",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": true,
"UserId": null,
"UserPrincipalName": null
},
{
"__metadata": {
"id": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9841)",
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9841)",
"type": "SP.User"
},
"Alerts": {
"__deferred": {
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9841)/Alerts"
}
},
"Groups": {
"__deferred": {
"uri": "https://(sharepointurl)/teams/(teamsnumber)/_api/Web/GetUserById(9841)/Groups"
}
},
"Id": 9841,
"IsHiddenInUI": false,
"LoginName": "c:0t.c|tenant|47356ff2-0203-7df4-3dfa-0993929f7cbf",
"Title": "TECH_2",
"PrincipalType": 4,
"Email": "",
"Expiration": "",
"IsEmailAuthenticationGuestUser": false,
"IsShareByEmailGuestUser": false,
"IsSiteAdmin": false,
"UserId": null,
"UserPrincipalName": null
}
]
}
}
From this I hope to filter out all the gunk to have only the following information from each http request; ID, Title & PrincipalType (The PrincipalType shows whether the entry is a User (1) or Security Group/Role (4))
I then want to place that information into an array / query that would look like the below:
For HTTP Request 1
ID | Title | PrincipalType |
5447 | Doe, John (TECH_1) | 1 |
2616 | Doe, Jack (TECH_BOSS) | 1 |
12467 | Doe, James (TECH_2) | 1 |
For HTTP Request 2
ID | Title | Principal Type |
9840 | TECH_1 | 4 |
9841 | TECH_2 | 4 |
From there I can compare the arrays from request 1 and request 2 for any duplicate. In this case there would be two duplicates - TECH_1 and TECH_2. That being the case I would then delete the two entries from the first permission group; Doe, John (TECH_1) and Doe, James (TECH_2) using the HTTP Post requests that I mentioned in my first post.
However! And it is quite a big however, I am struggling to filter the HTTP request and place it in an array. I was attempting to use the Compose action to only output the required data using the below uri (I was testing with just the key 'Id' and if it worked I'd do it with 'Title' and 'PrincipalType' too)
body('Send_an_HTTP_request_to_SharePoint')?['__metadata']?['Id']
However although the flow is successful it shows a blank input and output. I'm not sure where to go from here as attempting to use the Select or Filter array actions fail due to the HTTP Request being an object not an array.
Once again, any help would be greatly appreciated!!
All the best,
Ry
Another breakthrough!! This thread is just turning into my own little journal but for those of you who are enjoying watching my coffee fuelled power automate riddled descent into madness, enjoy!!
So I've finally managed to get the data I require, I've grabbed all the data using a HTTP request, I've parsed that data as a JSON and I've used the compose action to grab each iteration of the JSON with the data I require.
My flow now looks like this:
and the data outputted looks like this (personal details, once again, removed):
HTTP Request 1
- Compose 1
5447; Doe, John (TECH_1); 1
- Compose 2
2916; Doe, Jack (TECH_BOSS); 1
- Compose 3
12467; Doe, James (TECH_2); 1
HTTP Request 2
- Compose 1
9840; TECH_1; 4
- Compose 2
9841; TECH_2; 4
So, looking good right? Right! I can grab the data I require and I can scrape off all the gunk so I'm only left with the data I need.
Now the question is, how can I take each of the compose outputs and input them into an array so all the compose data from each HTTP request is stored in a nice, neat package?
Once I've got that all I need to do is take my two arrays from each HTTP Request, compare them to each other and check for duplicates.
I look forward to any suggestions!!
Until the next cup of coffee,
Ry
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages