How to generate a SharePoint List to pull users from Office 365?

Brass Contributor

We have created some great SharePoint lists for deployment purposes and the one SWEET function I would like to see is every time we generate a new SP list, it populates the Name field with users from Office 365 based on the location.  This would allow us to get active user lists instead of manually adding them.

 

One workaround we know works now is to export the users from Office 365 into a csv file and then import them into the list.  I would like this "process" to happen automatically when the list is created.

 

Any ideas?

11 Replies

@Derek Gillespie 

 

Sounds like you're going to want to create an app for this. Use the MS Graph for the User Info - https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http

@Timothy Balkthanks for the reply.  Taking a few steps back, create an app?  As in Power Apps?  Our environment is completely O365.

@Derek Gillespie Yes, that would be one way. Initiate the creation of the process via a PowerApp - collect the data you need to create the list, then trigger a PowerAutomate workflow to create the list and populate the list with the data from the User Graph API. I think the connector to create the list and pull the user data to the list may be custom connectors and would require some premium licenses to get that accomplished.

 

So the other app route would be to deploy PnP kind of solution that someone would have to write code to make things happen. Unfortunately, I'm not very familiar with what it would take to do this.

@Timothy Balk 

 

Without delving into learning PowerApps just yet,  is there a simple way to ask Sharepoint to auto load employee information like name, email, or dept based on Azure Active Directory information?  

 

Currently, I can search/find employees and add them to Sharepoint List column by searching for them using a company email address.     We also have unique identifiers like employee numbers that I'd like to use instead.   

1) How can I instruct SP to search for a person based on this number instead of their email address?     2) How can I link columns for "auto filling" subsequent columns with name, email, dept, etc from the unique number in Azure?

 

Appreciate your insight and thank you!

 

@ninjaryder actually I'd say that using Power Apps is your best option; it's not difficult to get or search for employees. We use it for a staff search app I built where you can enter the first letters of a name, job title, location or team name to bring back all the data on the employee(s) from Delve. We have over 1000 staff in our division and it runs very quickly. There are a lot of very good videos about Power Apps by Shane Young on YouTube and I recommend you have a look at those.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

 

 

@ninjaryder 

 

I'm thinking a bit on this - I think I need more information...

 

First pass at this problem, I would look at modifying the user profile synchronization attributes in the SharePoint Admin Center. Add the custom attribute for the ID: Add and edit user profile properties in SharePoint - SharePoint in Microsoft 365 | Microsoft Docs then you have to manage a process to sync this property - Bulk update custom user profile properties for SharePoint Online | Microsoft Docs which is kind of a bummer - if this were on-prem, you would be able to configure this custom property to pull the information from the synchronization connection.

 

Now for the search portion, are you talking about search via the people pickers? or about Search in the tenant?

 

Search in the tenant *I think* would automatically start indexing the custom attribute and would be searchable in the "People" portion of search. If it doesn't add it in automatically, you can modify the search schema and map the property to a managed property Manage the search schema in SharePoint - SharePoint in Microsoft 365 | Microsoft Docs then this property could be used in search.

 

The out of the box people picker is something different - honestly I don't think you could modify this to be searchable via a custom attribute. Also, I'm fairly sure the people pickers use Azure AD in SharePoint Online and the search function for this is immutable. I've submitted a few tickets to try to see if we could make the people picker remove accounts based on attributes in their profile and those answers have been "No".

 

As far as the information aside from the Custom ID attribute - have you had a look at the hidden user list? <Tenant SP Online URL>/_catalogs/users/simple.aspx Maybe this could be useful?

 

 

@Timothy Balk 

Thanks Timothy..   The Tenant and People Pickers are tools/language hare are above my knowledge/skill level..  I also do not have access to the Sharepoint Admin Center as I'm not in IT.  

 

I appreciate the response, but it might be that I need to learn PowerApps to build this.  I appreciate your insight and response, however. 

Could always ask IT about that identifier - if it's in the information for the users' profiles. I would think something like that would have been included since it sounds like the identifier is pretty important.

Don't be afraid to ask - if they're not sure, reference some of the documentation to support the question/request. Depending on the size of the company you work for - it might be easy to implement it.
@RobElliot, How did you get around delegation issues? How did you get the information from Delve rather than O365 users? I am building an app where my data source is 365 connector and I am only retrieving some of the records and it's driving me bonkers.
Wanted to follow up on this noting I didn't have to ask IT.. 1 day, I was scrolling through 20 different categorical field names of our profiles under "Get Employee" and found they tucked the Employee ID under a "Nickname" Field.... so I've been pulling/using that with the Dynamic Content in flows.. Thanks for the suggestion!
I suggest automating the synchronization of user data between Office 365 and SharePoint lists, especially for deployment purposes, can significantly streamline operations. The manual process of exporting and importing users is like tending a garden by hand-effective but labor-intensive. A practical solution lies in leveraging Microsoft Power Automate to create an automated workflow that triggers with each new SharePoint list creation. This workflow would fetch user information from Azure Active Directory, focusing on location-based attributes to tailor the user list accordingly. With the right conditions and actions set up, the workflow can populate your SharePoint list with the relevant user data automatically upon creation.

This method not only saves time but also ensures that your SharePoint lists are always up-to-date with active user information based on location, eliminating the need for manual updates. It might require initial setup and tweaking, particularly to filter users by location, but once in place, it's like having an automated garden that seeds itself - effortless and efficient. Remember, access permissions for Azure AD and SharePoint are crucial here, along with a good grasp of Power Automate for setting up the flow correctly. This approach turns a tedious task into a seamless part of your system administration routine, letting you focus on more strategic projects.