cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
donnadonut
Level: Powered On

Collection of office 365 Users?

Hi all,

 

I have built an app which is in production and working away nicley. The app has to have several screens that only certain managers can see. The app OnStart shows the following -
If(Mail = "user@example.com",Navigate(ManagerScreen,ScreenTransition.None), , Mail="user2@example.com", Navigate(ManagerScreen, ScreenTransition.None).....we have 20+ emails in here and i have this on most of the home icons of the shared screens too.

I am worried about there being too many emails listed and over time i expect more users to be added to this.

I was wondering if there was a way i can add these users to a collection, then i could use the collection as an If function? I cant seem to work this out so would appreciate any help or suggestions if there is a better way?

 

Thanks

Donna

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Collection of office 365 Users?

Hi @donnadonut ,

Do you want to check if the current sign user is an manager, if true, then navigate him/her to the Manager screen?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following:

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    User().Email in ManagerEmailCollection,       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    Mail in ManagerEmailCollection,
    Navigate(ManagerScreen, ScreenTransition.None)
)

Please consider take a try with above solution, then check if the issue is solved.

 

In addituion, you could also consider add a data source (e.g. a SP List) to store the managers' email. You could consider type the manager email within the Title column (one record for one Manger email). Then add this SP list in your app as data source, and set the OnStart property of the App control to following:

If(
    Lower(User().Email) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

If(
    Lower(Mail) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
panand99
Level 10

Re: Collection of office 365 Users?

Hi,

 

You can acheive this by many ways, one of the best way is:-

 

Create a list with only one defualt column- title, having all email ids of users.

 

//tempRequest is the new list 

 

Create a text input varialbe and on that - Find(Lower(User().Email) ,Lower(tempRequest.Title),1)

 

Now, - if(Value(<your text input varialble>0),Navigate....,otherNavigation)

 

 

donnadonut
Level: Powered On

Re: Collection of office 365 Users?

Thanks @panand99 but it doesnt seem to work for me.

 

I created a SharePoint list, added to data source, created text input but i have the attached errors.

Super User
Super User

Re: Collection of office 365 Users?

@donnadonut 

Now that you've created a list with the emails listed in it, change your OnStart formula to the following:

 

If(
!IsBlank(
Lookup(L3, Lower(Title)=Lower(Mail)).Title
),
Navigate(ManagerScreen, ScreenTransition.None)
)

This assumes that you have a varible called Mail.  

Also, since you are doing this in the OnStart, make sure that your App settings are not set to allow non-blocking OnStart rules as you'll want this to occur not in parallel with other rules.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Community Support Team
Community Support Team

Re: Collection of office 365 Users?

Hi @donnadonut ,

Do you want to check if the current sign user is an manager, if true, then navigate him/her to the Manager screen?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following:

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    User().Email in ManagerEmailCollection,       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

ClearCollect(
            ManagerEmailCollection,
            "user@example.com",
           "user2@example.com",
           "user3@example.com",
           ...
           "user20example.com",
           ...
);
If(
    Mail in ManagerEmailCollection,
    Navigate(ManagerScreen, ScreenTransition.None)
)

Please consider take a try with above solution, then check if the issue is solved.

 

In addituion, you could also consider add a data source (e.g. a SP List) to store the managers' email. You could consider type the manager email within the Title column (one record for one Manger email). Then add this SP list in your app as data source, and set the OnStart property of the App control to following:

If(
    Lower(User().Email) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

Or

If(
    Lower(Mail) in Lower('YourSPList'.Title),       /* or type User().Email in ManagerEmailCollection.Value */
    Navigate(ManagerScreen, ScreenTransition.None)
)

then re-load your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

donnadonut
Level: Powered On

Re: Collection of office 365 Users?

Hi all thank you so much for all your responses.

 

@v-xida-msft- i have adopted your solution and it is perfect! This has cleaned up things so much better in my app. Thank you so much! 🙂

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,362)