Forum Discussion

elmirt's avatar
elmirt
Copper Contributor
Jun 11, 2021

Add Teams group to Project for the Web with Power Automate

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:

 

 

 

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:

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

 

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

 

 

Thanks in advance 

Elmir 

 

 

  • PatrickGrebe's avatar
    PatrickGrebe
    Copper Contributor

    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/sample-assign-record-new-owner?view=op-9-1)

     

     

     

    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.

    • gbartumeu's avatar
      gbartumeu
      Brass Contributor

      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:

       

       

      • PatrickGrebe's avatar
        PatrickGrebe
        Copper Contributor
        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.
  • gbartumeu's avatar
    gbartumeu
    Brass Contributor
    We are in the same situation... Maybe the solution is in the entity called "msdyn_projectteamschannelmapping" or "msdyn_projectinternalconfiguration" or
  • PatrickGrebe's avatar
    PatrickGrebe
    Copper Contributor

    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.

Resources