Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

How to verify a user is active in Office 365 via SP list?

Hello All,


I have a SharePoint list where I have "Username" and "Email Address".  I need to create a gallery that displays the list but it only displays Users from that list who still have an active office 365 account.  I'm then needing to have a function where I could prune the users from the SharePoint list that aren't active any longer in AD, so have say a "prune disabled accounts" button that would remove any users who are in the SP list that are no longer in AD/Office365users.


I've toyed around with showing a gallery and then checking the list vs if the account is active and returning a true / false to a label in the gallery but I'm not sure how I then can filter that gallery based on that because it said something about circular references which I know I'm doing something wrong but just not sure how to fix it.


Here is what I'm using to show users from the SP List in the gallery and then the label that shows them as accountEnabled "true / False"

Gallery statement:
Filter('SharePoint List', Office365Users.UserProfileV2('Email Address').accountEnabled)

This has an issue due to the amount of items in the list.  It gives me a warning about filtering so I would like to fix that.  It also only shows the accounts that are "true"

Is there a way to figure out which accounts are false?  If so then I would want to take the ones that are false and have a button that would remove all those items from the SP list.

Any ideas?

Dual Super User
Dual Super User

Hi @PowerAppsJunkie 


How about have a Flow that runs periodically and updates SharePoint list with account enabled (Yes or No)


The in PowerApps just have a simple filter 

Filter(SharePointList, AccountEnabled = "yes")


If flow is not a preferred option,

then in PowerApps you would to get all the data in a gallery and then hide gallery item (for each item) by using Office365Users.UserProfileV2('Email Address').accountEnabled as Visible property



Reza Dorrani


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I was actually just exploring the option to create a flow that would lookup the users and if they are active to write a column item and then just filter it with PowerApps but I'm not sure how to do that.

The syntax of putting things together is where I struggle right now because I'm pretty new to Coding and Powerapps syntax. So it's a ton of trial and error on my end.

So any idea on the flow I'd create to do the list update? @RezaDorrani 

Ok So it looks like I can do a flow like this:

Use a get items flow to grab the items from the SP list
Do a for each so it gathers all items from the list

Then I do a get user from Azure AD

and do a condition if the Azure AD get user = the SP list items email then 
Update item in SP list field to yes or no

I got that part working in a flow so now I'll start working on the Powershell view

I am wondering if there is anyway to do it as well because I like exploring all options

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,684)