cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Continued Contributor
Continued Contributor

Connect to an Outlook distribution list

So I have a student profiles app. The screens are: NewStudentProfile, StudentGallery and EditProfile.

When students open the app, if they haven't already completed a profile, they will go to the NewStudentProfile screen.

If they have completed a profile, they will open to the StudentGallery.

 

However, all staff will be directed to StudentGallery (and will not need to add or edit profiles).

There is a distribution list for staff in Outlook that I'd like to use to identify whether the logged in user is staff or not.

What would be the best way I can do this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@calvares 

Yes, you can validate a user against a distro group.  You will need to use the AzureAD connector to do so.  You will also need to get the ID of your distribution group.  You can do this easily in the Azure AD Portal where you can list the groups.  They will have their unique ID.

 

Then in your App - at some point (usually this would be in the OnStart), this formula:

Set(glbIsStaff, 
    !IsEmpty(AzureAD.CheckMemberGroupsV2(User().Email, ["your-group-GUID-Identity-value"]).value)
)

This will give you a global app variable called glbIsStaff that will be true if they are a member and false if not.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@calvares 

Yes, you can validate a user against a distro group.  You will need to use the AzureAD connector to do so.  You will also need to get the ID of your distribution group.  You can do this easily in the Azure AD Portal where you can list the groups.  They will have their unique ID.

 

Then in your App - at some point (usually this would be in the OnStart), this formula:

Set(glbIsStaff, 
    !IsEmpty(AzureAD.CheckMemberGroupsV2(User().Email, ["your-group-GUID-Identity-value"]).value)
)

This will give you a global app variable called glbIsStaff that will be true if they are a member and false if not.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

calvares
Continued Contributor
Continued Contributor

That's great. Thank you @RandyHayes
calvares
Continued Contributor
Continued Contributor

@RandyHayes So I'm using the correct guid group ID and referencing it against User().Email but glbIsStaff is true when it should be false. I think the variable defaults to true if there is a problem matching up. As we have two email formats for users at our organisation, I think User().Email is the wrong one. But then it doesn't seem to like it if I use anything other than User().Email.

Is there anything else I could try?

@calvares 

Yes, we have two (actually more) domains here also (I assume that is what you mean by "email formats").  The match is against the primary email of the user, not any aliases. However, User().Email should return the primary - so that should validate.

I have the same little test app here and I get true if for an email that is in a group and false for an email not in the group.  If I choose one of my other emails to test, it will return false - only true on the primary email.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
calvares
Continued Contributor
Continued Contributor

Thanks @RandyHayes . Yes, I meant domains...

I believe I have it working finally. I was using an If statement which was wrong and setting glbIsStaff to true, when that should have been part of the logical statement.

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (18,569)