title: How to create Microsoft Team via Microsoft Graph API with Owners specified by User Email rather than User ID?
body: <p><strong>Desired Behaviour</strong></p>
  <p>Create a Microsoft Team, with specified Owners and Members, in a Power Automate Flow using the HTTP connector to make requests to the Microsoft Graph API.</p>
  <p><strong>Actual Behaviour</strong></p>
  <p>This code shows how you can create a Microsoft Team whilst specifying it's Owners by <code>User ID</code>.</p>
  <pre><code>{
      &quot;template@odata.bind&quot;: &quot;https://graph.microsoft.com/v1.0/teamsTemplates('standard')&quot;,
      &quot;displayName&quot;: &quot;My Sample Team&quot;,
      &quot;description&quot;: &quot;My Sample Team’s Description&quot;,
      &quot;members&quot;: [
      {
          &quot;@odata.type&quot;: &quot;#microsoft.graph.aadUserConversationMember&quot;,
          &quot;roles&quot;: [
              &quot;owner&quot;
          ],
          &quot;user@odata.bind&quot;: &quot;https://graph.microsoft.com/v1.0/users('0040b377-61d8-43db-94f5-81374122dc7e')&quot;
      }]
  }
  </code></pre>
  <p><a href="https://docs.microsoft.com/en-us/graph/api/team-post?view=graph-rest-1.0&amp;tabs=http#example-2-application-permissions" rel="nofollow noreferrer">Source</a></p>
  <p>For reference, the Graph API docs entry for <a href="https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&amp;tabs=http#http-request" rel="nofollow noreferrer">Get a user</a> (which is used to specify the <code>Owner</code> in the code above), specifies the endpoint syntax as:</p>
  <pre><code>GET /users/{id | userPrincipalName}  
  </code></pre>
  <p>Currently, I do not have access to users' <code>id</code> or <code>userPrincipalName</code>.</p>
  <p><strong>What I've Tried</strong></p>
  <p>I am using a Power Automate Flow with the SharePoint <code>For a selected item</code> trigger.</p>
  <p>The list includes two columns of type <code>Person</code> where <code>Owners</code> and <code>Members</code> are specified.</p>
  <p>In order to get a list of <code>Owners</code>, I am using the SharePoint connector's <a href="https://docs.microsoft.com/en-us/connectors/sharepointonline/#get-item" rel="nofollow noreferrer">Get item</a> action on the selected item and then using an <code>Apply to each</code> control to iterate over each columns' values.</p>
  <p>Below is the <code>Raw Output</code> of <code>Get Item</code> - the <code>Owners</code> column array is <code>TeamOwner_x002f_s</code>.</p>
  <p>You can see that each object only has <code>DisplayName</code> and <code>Email</code> and not <code>User ID</code> or <code>userPrincipalName</code>:</p>
  <pre><code>{
      &quot;statusCode&quot;: 200,
      &quot;headers&quot;: {
          &quot;Transfer-Encoding&quot;: &quot;chunked&quot;,
          &quot;Vary&quot;: &quot;Origin,Accept-Encoding&quot;,
          &quot;X-SharePointHealthScore&quot;: &quot;1&quot;,
          &quot;X-MS-SPConnector&quot;: &quot;1&quot;,
          &quot;X-SP-SERVERSTATE&quot;: &quot;ReadOnly=0&quot;,
          &quot;DATASERVICEVERSION&quot;: &quot;3.0&quot;,
          &quot;SPClientServiceRequestDuration&quot;: &quot;68&quot;,
          &quot;SPRequestGuid&quot;: &quot;letters-and-numbers&quot;,
          &quot;request-id&quot;: &quot;letters-and-numbers&quot;,
          &quot;MS-CV&quot;: &quot;letters-and-numbers.0&quot;,
          &quot;Strict-Transport-Security&quot;: &quot;max-age=31536000&quot;,
          &quot;X-FRAME-OPTIONS&quot;: &quot;SAMEORIGIN&quot;,
          &quot;Content-Security-Policy&quot;: &quot;frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;&quot;,
          &quot;MicrosoftSharePointTeamServices&quot;: &quot;numbers-and-dots&quot;,
          &quot;X-Content-Type-Options&quot;: &quot;nosniff&quot;,
          &quot;X-MS-InvokeApp&quot;: &quot;1; RequireReadOnly&quot;,
          &quot;Timing-Allow-Origin&quot;: &quot;*&quot;,
          &quot;x-ms-apihub-cached-response&quot;: &quot;false&quot;,
          &quot;Cache-Control&quot;: &quot;max-age=0, private&quot;,
          &quot;Date&quot;: &quot;Sun, 04 Jul 2021 06:42:53 GMT&quot;,
          &quot;P3P&quot;: &quot;CP=\&quot;SOME CODES HERE\&quot;&quot;,
          &quot;X-AspNet-Version&quot;: &quot;4.0.30319&quot;,
          &quot;X-Powered-By&quot;: &quot;ASP.NET&quot;,
          &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot;,
          &quot;Expires&quot;: &quot;Sat, 19 Jun 2021 06:42:54 GMT&quot;,
          &quot;Last-Modified&quot;: &quot;Sun, 04 Jul 2021 06:42:54 GMT&quot;,
          &quot;Content-Length&quot;: &quot;3938&quot;
      },
      &quot;body&quot;: {
          &quot;@odata.etag&quot;: &quot;\&quot;2\&quot;&quot;,
          &quot;ItemInternalId&quot;: &quot;1&quot;,
          &quot;ID&quot;: 1,
          &quot;Title&quot;: &quot;View&quot;,
          &quot;Year&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference&quot;,
              &quot;Id&quot;: 2,
              &quot;Value&quot;: &quot;2023&quot;
          },
          &quot;Year#Id&quot;: 2,
          &quot;ProgramType&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference&quot;,
              &quot;Id&quot;: 0,
              &quot;Value&quot;: &quot;Program Type 01&quot;
          },
          &quot;ProgramType#Id&quot;: 0,
          &quot;ProgramName&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference&quot;,
              &quot;Id&quot;: 1,
              &quot;Value&quot;: &quot;02&quot;
          },
          &quot;ProgramName#Id&quot;: 1,
          &quot;TeamOwner_x002f_s&quot;: [
              {
                  &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser&quot;,
                  &quot;Claims&quot;: &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
                  &quot;DisplayName&quot;: &quot;User Name 1&quot;,
                  &quot;Email&quot;: &quot;user_1@my-tenant.onmicrosoft.com&quot;,
                  &quot;Picture&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/UserPhoto.aspx?Size=L&amp;AccountName=user_1@my-tenant.onmicrosoft.com&quot;,
                  &quot;Department&quot;: null,
                  &quot;JobTitle&quot;: null
              },
              {
                  &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser&quot;,
                  &quot;Claims&quot;: &quot;i:0#.f|membership|user_2@my-tenant.onmicrosoft.com&quot;,
                  &quot;DisplayName&quot;: &quot;User Name 2&quot;,
                  &quot;Email&quot;: &quot;user_2@my-tenant.onmicrosoft.com&quot;,
                  &quot;Picture&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/UserPhoto.aspx?Size=L&amp;AccountName=user_2@my-tenant.onmicrosoft.com&quot;,
                  &quot;Department&quot;: null,
                  &quot;JobTitle&quot;: null
              }
          ],
          &quot;TeamOwner_x002f_s@odata.type&quot;: &quot;#Collection(Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser)&quot;,
          &quot;TeamOwner_x002f_s#Claims&quot;: [
              &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;i:0#.f|membership|user_2@my-tenant.onmicrosoft.com&quot;
          ],
          &quot;TeamOwner_x002f_s#Claims@odata.type&quot;: &quot;#Collection(String)&quot;,
          &quot;Team_x0020_Member_x002f_s&quot;: [
              {
                  &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser&quot;,
                  &quot;Claims&quot;: &quot;i:0#.f|membership|user_3@my-tenant.onmicrosoft.com&quot;,
                  &quot;DisplayName&quot;: &quot;User Name 3&quot;,
                  &quot;Email&quot;: &quot;user_3@my-tenant.onmicrosoft.com&quot;,
                  &quot;Picture&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/UserPhoto.aspx?Size=L&amp;AccountName=user_3@my-tenant.onmicrosoft.com&quot;,
                  &quot;Department&quot;: null,
                  &quot;JobTitle&quot;: null
              }
          ],
          &quot;Team_x0020_Member_x002f_s@odata.type&quot;: &quot;#Collection(Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser)&quot;,
          &quot;Team_x0020_Member_x002f_s#Claims&quot;: [
              &quot;i:0#.f|membership|user_3@my-tenant.onmicrosoft.com&quot;
          ],
          &quot;Team_x0020_Member_x002f_s#Claims@odata.type&quot;: &quot;#Collection(String)&quot;,
          &quot;Status&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference&quot;,
              &quot;Id&quot;: 0,
              &quot;Value&quot;: &quot;Details Added&quot;
          },
          &quot;Status#Id&quot;: 0,
          &quot;Modified&quot;: &quot;2021-07-04T03:57:16Z&quot;,
          &quot;Created&quot;: &quot;2021-07-04T03:51:18Z&quot;,
          &quot;Author&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser&quot;,
              &quot;Claims&quot;: &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;DisplayName&quot;: &quot;User Name 1&quot;,
              &quot;Email&quot;: &quot;user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;Picture&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/UserPhoto.aspx?Size=L&amp;AccountName=user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;Department&quot;: null,
              &quot;JobTitle&quot;: null
          },
          &quot;Author#Claims&quot;: &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
          &quot;Editor&quot;: {
              &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser&quot;,
              &quot;Claims&quot;: &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;DisplayName&quot;: &quot;User Name 1&quot;,
              &quot;Email&quot;: &quot;user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;Picture&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/UserPhoto.aspx?Size=L&amp;AccountName=user_1@my-tenant.onmicrosoft.com&quot;,
              &quot;Department&quot;: null,
              &quot;JobTitle&quot;: null
          },
          &quot;Editor#Claims&quot;: &quot;i:0#.f|membership|user_1@my-tenant.onmicrosoft.com&quot;,
          &quot;{Identifier}&quot;: &quot;Lists%252fMy%2bList%2bName%252f1_.000&quot;,
          &quot;{IsFolder}&quot;: false,
          &quot;{Thumbnail}&quot;: {
              &quot;Large&quot;: null,
              &quot;Medium&quot;: null,
              &quot;Small&quot;: null
          },
          &quot;{Link}&quot;: &quot;https://my-tenant.sharepoint.com/sites/ExampleTeam/_layouts/15/listform.aspx?PageType=4&amp;ListId=list-id-here&amp;ID=1&amp;ContentTypeID=content-type-id-here&quot;,
          &quot;{Name}&quot;: &quot;View&quot;,
          &quot;{FilenameWithExtension}&quot;: &quot;View&quot;,
          &quot;{Path}&quot;: &quot;Lists/My List Name/&quot;,
          &quot;{FullPath}&quot;: &quot;Lists/My List Name/1_.000&quot;,
          &quot;{VersionNumber}&quot;: &quot;2.0&quot;
      }
  }
  </code></pre>
  <p><strong>Question</strong></p>
  <p>Is it possible to specify Team members by <code>Email</code> in the Graph API request?
  Or do I need to somehow get the <code>User ID</code> of each user specified (and if so, what is the best way to do that)?</p>
  <p><strong>Update</strong></p>
  <p>I tried this <code>HTTP</code> connector <code>GET</code> request in the hopes it would return <code>User ID</code> for each <code>Person</code>:</p>
  <pre><code>https://graph.microsoft.com/v1.0/sites/site-id-here/lists/list-id-here/items/item-id-here?expand=fields(select=TeamOwner%5Fx002f%5Fs)
  </code></pre>
  <p>But it returned even less information:</p>
  <pre><code>&quot;fields&quot;: {
      &quot;@odata.etag&quot;: &quot;\&quot;letters-and-numbers,2\&quot;&quot;,
      &quot;TeamOwner_x002f_s&quot;: [{
              &quot;LookupId&quot;: 9,
              &quot;LookupValue&quot;: &quot;User Name 1&quot;,
              &quot;Email&quot;: &quot;user_1@my-tenant.onmicrosoft.com&quot;
          },
          {
              &quot;LookupId&quot;: 27,
              &quot;LookupValue&quot;: &quot;User Name 2&quot;,
              &quot;Email&quot;: &quot;user_2@my-tenant.onmicrosoft.com&quot;
          }
      ]
  }
  </code></pre>
  <p><a href="https://docs.microsoft.com/en-us/graph/api/listitem-get?view=graph-rest-1.0&amp;tabs=http#http-request" rel="nofollow noreferrer">API docs reference for this approach</a></p>
  <blockquote>
  <p>Get specific column values of a listItem</p>
  </blockquote>
  <pre><code>GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}?expand=fields(select=Column1,Column2)
  </code></pre>