cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efledammmt
Frequent Visitor

Unable to assign a mail-enabled security group ID to a variable

Hi,

 

I am having error from power apps when I assign a variable to a group ID. Here is my code. 

 

It's working fine when I put 

"mymail@mail.com" in Office365Groups.ListGroupMembers("abcdef6-123c-123d-23edc-abcd488abce6").value.mail;

 

But when I assign it to a variable as below code. It's giving me an error.

Set(varGroupID,"abcdef6-123c-123d-23edc-abcd488abce6"); 

"mymail@mail.com" in Office365Groups.ListGroupMembers(varGroupID).value.mail;

 

Could someone help? Any reply is appreciated

9 REPLIES 9
UdayAdhikari
Continued Contributor
Continued Contributor

Hi @efledammmt - everything looks good. Did you get it working? What error are you getting? Can you post screen captures of error and formula where its being set, used? I have seen this not work before when O365 Group GUID Id is invalid (like space at the end with error msg like "Invalid Object Identifier"), it does not look that way in your case but I would double check the id are somehow invalid/not matching. Keep us posted.

 

Thanks

 

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.

Hi @UdayAdhikari, here is the screenshot of the error I am receiving. As far as I am concerned, the ID are matching as I only copy and paste the value when assigning the variable.

 GroupIdError.PNG

I have further tried to change the data type to GUID as below, but it's not working either.

 

Set(varGroupID,GUID("abcdef6-123c-123d-23edc-abcd488abce6")); 

"mymail@mail.com" in Office365Groups.ListGroupMembers(varGroupID).value.mail;

UdayAdhikari
Continued Contributor
Continued Contributor

Hi @efledammmt - I wonder if your GUID is not an O365 Group GUID based on the error message. In my case I confirmed by it was and tested below which worked:

 

Screen > OnVisible = Set(gblGroupId, "111c6fae-6e0b-11ce-1111-a1111ec8a86f")

And set text property of a label control to:

If("xxxx@yyyyy.onmicrosoft.com" in Office365Groups.ListGroupMembers(gblGroupId).value.mail, "Found", "Not found")

 

Returned "Found" when valid email was passed.

 

Not sure how mail enabled security group works with O365 Groups connector. If you have access to admin portal, I would look  at https://portal.azure.com/#blade/Microsoft_AAD_IAM/GroupsManagementMenuBlade/AllGroups and confirm the GUID exists first.

 

Thanks

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.

Hi @UdayAdhikari

 

When I tested with another different O365 group, it's working fine too for assigning the group id to a variable. 

 

The group Id that I have got is taken from azure admin portal and it's correct. The puzzling thing is that when it's keyed in as the raw id in the "ListGroupMembers", it has no error and can give out the correct result. Once, it's assigned to a variable, it's giving out the error. Not sure, if it's because of mail enabled security group.

 

Anyway thanks for your reply.

 

 

You can only list Microsoft 365 group by using Office 365 Groups:

linxiao_0-1597414350044.png

If you want to list Distribution group, please use Azure AD connector.

 

Hi @linxiao

 

For Azure AD connector, it is however, mentioned that it doesn't support mail-enabled security groups in the website, https://docs.microsoft.com/en-us/connectors/azuread/.

efledammmt_0-1597820609899.png

 

Also, may I know if the users of the apps need admin password when using the apps if Azure AD connector is used in the apps.

 

Thanks.

Are you trying to list a email enabled security group?

 

To use the Azure AD connector, the account needs to have the following administrator permissions:

  • Group.ReadWrite.All
  • User.ReadWrite.All
  • Directory.ReadWrite.All

Which means you don't admin password but the account should have above admin permissions.

Hi @linxiao 

 

Yes. I am trying to list mail-enabled security group. 

 

Thanks for the reply on admin permission. May I know what is the procedure for an ordinary user to have admin permission? E.g. like keying the admin password for the ordinary user at the start of an apps ONCE? or keying admin password is needed every time an ordinary user starts the apps?

 

Thanks.

Then you cannot user Azure AD connector.

 

Please go to https://admin.microsoft.com and locate to Users\Active Users to provision admin permissions for specific users.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,966)