Smarter Business Solutions Logo
SMARTER Business Solutions
SharePoint Lösungen & Produkte

Development of a SharePoint Phone Directory Web Part

Our SharePoint phone directory web part lists members of configured Active Directory or security groups and displays details like job title, phone and email.

5 Min Read

We recently received a request from a customer to build a SharePoint phone directory. The goal was to display users from Active Directory groups and security groups. For each person, the customer wanted to show information such as job title, phone number, email address, and more. In this post, we share how we built this SharePoint phone directory web part.

Default SharePoint People web part vs. our phone directory web part

SharePoint Online includes a default People web part that can show user profiles. However, the customer would have to add every user manually. Whenever group membership changes, it would also need to be updated by hand. To keep the effort as low as possible, the customer asked that all users of a configured Active Directory group or security group be displayed automatically.

We implemented the phone directory as an SPFx web part. An admin can configure the groups in the web part properties.

SharePoint phone directory: Web part settings

We read user information via the Microsoft Graph API and render it in the web part. When you hover a user, the component shows their details in a popover—the same behavior as the default People web part.

SharePoint phone directory: User information

Sorting users via drag & drop

Another requirement was the ability to order users within a group. We implemented this with drag and drop. When the page is in edit mode, drag and drop becomes active, and an admin can arrange users in the desired order.

SharePoint phone directory: User sorting

We store the order per group in a configuration file in SharePoint. On page load, we read the configuration and sort the users accordingly.

{
  "groups": [
    {
      "title": "Test",
      "orderedUserIds": [
        "flo@openinnovationhub.onmicrosoft.com",
        "verena@openinnovationhub.onmicrosoft.com",
        "josef@openinnovationhub.onmicrosoft.com",
        "cerima@openinnovationhub.onmicrosoft.com"
      ]
    }
  ]
}

Tags

#Microsoft 365 #O365 #SharePoint #SPFx web part #User adoption

Ready to transform your SharePoint?

Let our experts help you implement the solutions discussed in this article.