Add Teams group to Project for the Web with Power Automate

Occasional Visitor

Hello,

 

we are looking for a solution to add  a Teams group to a project in "Project for the Web" with a flow. 

In the web we have just to select the group and click on "Add" like in the screenshot:

 

elmirt_0-1623421273045.png

 

 

Now we have a flow which creates a Teams team (it works fine) and we want to add the created team to a project in PftW. 

We tried it with the standard Dataverse connectors but didnt find the correct field for this:

elmirt_1-1623421609025.png

We also checked the new API: https://docs.microsoft.com/en-us/dynamics365/project-operations/project-management/schedule-api-prev... 

 

Is it possible to add a team to the project with a flow?

 

 

Thanks in advance 

Elmir 

 

 

10 Replies
We are in the same situation... Maybe the solution is in the entity called "msdyn_projectteamschannelmapping" or "msdyn_projectinternalconfiguration" or

@elmirt I'm looking for the same, did you find out how to do it?

 

Br

Anders

@elmirt Did you find a solution to this issue. We are also trying to find an automated way to integrate in teams.

@elmirt  We are in the same situation. If you do this via the web interface, the "ownerid" and "owningteam" values are updated in the "msdyn_projects" entity.

The AAD group is then connected to a team (entity teams). If I do the whole thing via HTTP-PATCH, the attributes are also set accordingly, but the group is still not displayed as connected in the web interface.

We have now solved the whole thing using an Azure Function (within a Logic App) and corresponding C# code.

We create a team and link it to an AAD group. The team is then assigned the appropriate security role. (https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/org-service/sa...)

 

 

 

var projectteam = new Entity("team", Guid.NewGuid());
projectteam["name"] = officeGroupName;
projectteam["businessunitid"] = new EntityReference("businessunit",Guid.Parse("GUID_BUSINESSUNIT_HERE"));
projectteam["azureactivedirectoryobjectid"] = officeGroupId;
projectteam["teamtype"] = 3;
projectteam["membershiptype"] = 0;
projectteam.Id = crmServiceClient.Create(projectteam);

// Add the role to the team.
crmServiceClient.Associate(
    "team",
    projectteam.Id,
    new Relationship("teamroles_association"),
    new EntityReferenceCollection() { new EntityReference("role", Guid.Parse("SEC-ROLE-GUID-HERE")) });

 

 

 

We then create the project with the API "msdyn_CreateProjectV1". Here we then set the "ownerid" to the ID of the created team.

 

 

 

project["ownerid"] = new EntityReference("team", Guid.Parse(projectteam.Id.ToString()));

 

 

It takes some time until the connection is shown in P4W.

Hello @PatrickGrebe,

 

I use Power Automate to update the ownerid field from the entity msdyn_project with the teamid field located in the entity "Team" but it still does not update this change on Project for the web:

 

gbartumeu_0-1645812571710.png

 

I haven't tested this with a flow. However, the project creation should take place via an unbound action and the API "msdyn_CreateProjectV1". We do not update the ownerid, but maintain it directly when it is created. Here you can then set the "ownerid" directly to the team. As already mentioned, it takes 15-30 minutes before the connection is shown in P4W.

Important: If the team was newly created, a role must be added to it.

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! :stareyes:

 

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,

 

 

Sounds good.
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.

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.