Forum Discussion
Add Teams group to Project for the Web with Power Automate
Hello PatrickGrebe,
Thanks for your response. As you said, it took a while but now I see the project it's being assigned to the team!
Could you explain me which role and how I must assign it to the Team? Do you refer the "team" entity record or the AAD Group?
Thanks in advance,
We currently do it like this:
1. Create a Microsoft 365 Group (including a Microsoft Team)
2. Create a new record in the "team(s)" entity (connected to the AAD group created in step 1) (https://XXX.crm4.dynamics.com/api/data/v9.1/teams) .
3. Connect the role (https://XX.crm4.dynamics.com/api/data/v9.1/roles) "Project Team Member" to the team created in step 2.
Also see my code from the previous answer. azureactivedirectoryobjectid equals to the group id created in step 1.
- PhilippS1Jul 14, 2023Copper Contributor
Hi Patrick, I am trying to implement the whole thing in PowerAutomate.
1. first I create the team.
2. wait 2min
3. add an entry in the Dataverse table "Teams" (see second screenshot)
4. after that I create the project in the table "projects" with the TeamID as owner.I seem to be missing the step where I add the role "Project Team Member" to the team. Unfortunately I have no idea where to find this.
Do you have a hint for me please?
Here is the error message I get:
"URL was not parsed due to an ODataUnrecognizedPathException. Resource not found for the segment provided in the URL."I think this suggests that a relation is missing to another table? Probably owner?
- gbartumeuJul 19, 2023Brass Contributor
Hello PhilippS1,
I did it using Power Automate.
On Dataverse, the Team table will automatically add the Team you recently created. But if you want you can add it by yourself.
Then you will need to relate this Team with Team roles associations: Project Team Memeber and Project Common.
Here is how I have done it using a "Relate Action" (In Spanish..):
1. Table name: Teams
2. Row Id: Your Team Id
3. Relate: Team Role Associaton table
4. Relate with: https://[Your dynamics URL]/api/data/v9.1/roles(ROLE ID), where the role ID you should copy it from your "Team Roles" Dataverse table.
Hope it helps!!
- PhilippS1Aug 01, 2023Copper ContributorIt is really uncomfortable for me to ask, but I just can't get on here by myself and would be very happy about further help 🙂
- PatrickGrebeJul 18, 2023Copper Contributor
PhilippS1Hello, we have never tried it via Power Automate, so I cannot assist you further here. Unfortunately, I don't have the time to reproduce the whole thing. Perhaps an Unbound Action might help in this case.
- SpyrosM1980Aug 26, 2022Copper Contributor
Hi Patrick,
Is the mechanism you described still functional? We tried the exact same steps through code in order to create and assign a P4TW project, using the exact steps (Create a group, create a Team with reference to the group, assign a role to a team, create the project with the team as the owner), however while the project is created successfully, along with the group and the respective teams and roles, we still don't get to see it "linked" to the newly created Group (even after several hours).
The user has to open the project and manually and link the project with the group:
We compared the rows created in the dataverse from manual assignment, to the ones auto created by our code and they are exactly the same. Are we missing any step?
Thanks
- PatrickGrebeAug 29, 2022Copper Contributor
SpyrosM1980 Hi, the whole thing works smoothly for us as I described above. (just tested)
We create the Office365 group via LogicApp. Then we wait about 2 minutes before we create the team in Dynamics and connect it to the Office365 group. (via Azure Function)
It takes between 15-60 minutes until the connection is displayed correctly in P4W.
- SpyrosM1980Aug 30, 2022Copper Contributorjust wanted to say thanks, and followup to any one who is interested:
Indeed the key here was waiting for a couple of minutes after group creation. When we inserted a delay among these two actions, the group was linked correctly in P4TW. So to sum up, the process is:
1) Create Group in O365
2) wait for 2 minutes
3) Create a record in Teams entity with azureactivedirectoryobjectid=[group id]
4) Assign the role "Project Team Member" to the newly created Team
5) [Create the project if not exists]
6) Set the owner to the id of the newly created team
7) [wait for 15-60 minutes to see the linked group in P4TW]
To be honest, our users are frustrated especially with the last delay, if anybody knows how to force any refresh job to run let us know, because the process runs from the UI in seconds, so something different may be happening there.
Thanks again for your help
- Barend De SaegerJun 17, 2022Copper Contributor
Anyone has an idea how to give prvCreateTeam permissions to the Teams table? I've granted full permissions in the default environment Business Management Section but I keep getting below error:
{"error":{"code":"0x80040220","message":"Principal user (Id=c2500728-e5e7-ec11-bb3c-0022489f76c6, type=8, roleCount=4, privilegeCount=256, accessMode=0), is missing prvCreateTeam privilege (Id=4807b998-6b4f-4d57-9cf6-515f50e43d79) on OTC=9 for entity 'team' (LocalizedName='Team').
context.Caller=c2500728-e5e7-ec11-bb3c-0022489f76c6. Or identityUser.SystemUserId=d9e8da9f-e1e7-ec11-bb3c-0022489f76c6, identityUser.Privileges.Count=260, identityUser.Roles.Count=4 is missing prvCreateTeam privilege (Id=4807b998-6b4f-4d57-9cf6-515f50e43d79) on OTC=9 for entity 'team' (LocalizedName='Team')."}}EDIT:
I managed to solve the issue, I'm delegating to a licensed service account but the application registration user also needed permissions on the Teams table.
- ankitjanaSep 25, 2023Copper ContributorHi Barend De Saeger,
I am getting same error. Could you please let me know how did you solve this? What permission was missing for which user?
Thanks,- Barend De SaegerSep 25, 2023Copper ContributorHi Ankitjana,
I was doing it in PowerShell and the application (registration) user also needed the 'Create' permission on the Team entity.
Kr,
Barend