cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
usarif
Resolver I
Resolver I

powerapps: Azure.AD.GetUser to textinput box

Folks,

 Trying to create really simple app to add user to group. I have two text input, first username and business group (as shown in attach). I like to verify when I enter display name or username to Username input. I have connector attach to Azure AD. Can't seems like to figure it, looking for helps for expert here.

powerapps.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Microsoft
Microsoft

Hi @usarif ,

 

Would you like to:

  1. Verify the User name typed in the TextInput box, if in Azure AD, show the Check icon;
  2. Select the Group for user to be added in.
  3. Add user into the selected Group on submit buttons pressing.

 

If so, below are steps in my test:

1. Set below formula on App's OnStart or the Screens OnVisible, it would retrieve all groups YOU are in:

 

ClearCollect(
       AllGroups,
       AddColumns(
                   AzureAD.GetMemberGroups("Your Email Address",false).Value,
                   "GroupName",
                   AzureAD.GetGroup(Value).mail
       )
)

 

2. Set Items of the Combo Box to AllGroups

 

3. Set Visible of the Check icon to:

 

If(!IsBlank(First(Office365Users.SearchUserV2({searchTerm:TextInput1.Text}).value)),true,false)

 

4. Set the submit button to:

 

Office365Groups.AddMemberToGroup(
    Dropdown5.Selected.Value,
    First(Office365Users.SearchUserV2({searchTerm: TextInput1.Text}).value).UserPrincipalName
)

 

5. You could also set DisplayMode of the Submit button to below so when names failed verification the button would be disabled:

 

If(!IsBlank(First(Office365Users.SearchUserV2({searchTerm:TextInput1.Text}).value)), DisplayMode.Edit,DisplayMode.Disabled)

 

group.gif

If you would like to retrieve all groups including those you are not in, you'll need to access Microsoft Graph API using Custom Connector, below is the tutorial:

https://gotoguy.blog/2017/12/17/access-microsoft-graph-api-using-custom-connector-in-powerapps-and-f...

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Hi @usarif ,

The Office365Groups connector has an options to do this.

First connect this to your data sources then the syntax

Office365Groups.AddMemberToGroup(GroupId,UserUPN)

Here is a guide relating to the UPN.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

thanks Super User to your reply. 

First step, i like to verify user through azure ad like AzureAD.GETUSER in user name input txt box. so i typer username it will verify user. 

Hi @usarif ,

I did a blog on a related issue that may be of assistance. I have not tested what you are requiring and currently cannot, but think this process may be what you need.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-jefferni
Microsoft
Microsoft

Hi @usarif ,

 

Would you like to:

  1. Verify the User name typed in the TextInput box, if in Azure AD, show the Check icon;
  2. Select the Group for user to be added in.
  3. Add user into the selected Group on submit buttons pressing.

 

If so, below are steps in my test:

1. Set below formula on App's OnStart or the Screens OnVisible, it would retrieve all groups YOU are in:

 

ClearCollect(
       AllGroups,
       AddColumns(
                   AzureAD.GetMemberGroups("Your Email Address",false).Value,
                   "GroupName",
                   AzureAD.GetGroup(Value).mail
       )
)

 

2. Set Items of the Combo Box to AllGroups

 

3. Set Visible of the Check icon to:

 

If(!IsBlank(First(Office365Users.SearchUserV2({searchTerm:TextInput1.Text}).value)),true,false)

 

4. Set the submit button to:

 

Office365Groups.AddMemberToGroup(
    Dropdown5.Selected.Value,
    First(Office365Users.SearchUserV2({searchTerm: TextInput1.Text}).value).UserPrincipalName
)

 

5. You could also set DisplayMode of the Submit button to below so when names failed verification the button would be disabled:

 

If(!IsBlank(First(Office365Users.SearchUserV2({searchTerm:TextInput1.Text}).value)), DisplayMode.Edit,DisplayMode.Disabled)

 

group.gif

If you would like to retrieve all groups including those you are not in, you'll need to access Microsoft Graph API using Custom Connector, below is the tutorial:

https://gotoguy.blog/2017/12/17/access-microsoft-graph-api-using-custom-connector-in-powerapps-and-f...

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (37,838)