B
Bonzai 2
Web Parts

Employee Directory

Employee directory with search, alphabetical filter, dropdown filters, sort, and card/list views. Supports search mode and pinned employee mode.

PeopleFeature Parity: 95%

Get Employee Directory Working in 4 Steps

10-20 minutes

Prerequisites

  • Bonzai 2 package installed on your site
  • User profiles configured in Azure AD / SharePoint
1

Add the web part to your page

Edit the page, click +, search for "Employee Directory", and add it to a section.

2

Set the Result Source

Open the property pane and select a Result Source. Use “Auto-detect (Recommended)” to let the web part pick the best option for your tenant, or choose “Local People Results” / a custom GUID if your organization uses a dedicated people result source.

3

Choose display mode

Select Search Directory (default) or Pinned Employees in the Display Mode section.

4

Enable filters and publish

Optionally enable filter dropdowns, sort, and view switching in View & Filter Options, then publish.

When to Use This Web Part

Use this when you need to...

  • Create a company-wide employee directory
  • Enable users to find colleagues by name or department
  • Display contact information for employees
  • Link to user profiles in SharePoint/Delve
  • Browse employees alphabetically
  • Show pinned employees on a team page

Best page locations

  • People page — dedicated employee directory
  • About Us page — company org overview
  • Department pages — team member listings
  • Contact page — find the right person

Consider alternatives when...

  • Displaying a specific list of featured people — use People Listing
  • Showing organizational hierarchy — use Org Chart solutions
  • Listing external contacts — use a custom list with People Listing

Related web parts:

People Listingcurated list from a SharePoint listLocationsoffice locations with contacts

Recent Updates

  • New: require:field rule in Exclusion Rules (Graph mode) — drops rows whose field is empty or whitespace-only (e.g. require:department hides accounts with no department). Pushed server-side as a Graph $filter so the result counter stays accurate.
  • Fixed: Graph mode now correctly handles company / department / office names containing special characters (&, +, ?, #, etc.). Previously, names like "First United Bank & Trust" produced 400 errors or "unterminated string literal" failures because the & split the query string. $filter, $select, $search, and $orderby are now URL-encoded.
  • Improved: scatter-gather sorting in Microsoft Graph mode — sorting by Department / Job Title / Office now sorts the entire population (not just the current page). The service bulk-fetches across cursor pages and merges client-side.
  • Improved: "Showing X-Y of Z" counter is now accurate in Graph mode after server-side filters and exclusion rules are applied. @odata.count now reflects the filtered population the user actually sees.
  • Internal: shared default constants (DEFAULT_ITEMS_PER_PAGE = 28, DEFAULT_PINNED_ITEMS_PER_PAGE = 12, DEFAULT_PINNED_ITEMS_PER_ROW = 4) now drive the property-pane slider, render defaulting, and the React component in lockstep.

Display Modes & Views

  • Search Directory: Full directory with search, A–Z filtering, filter dropdowns, sort, and Card/List views.
  • Pinned Employees: Curated people list. Two selection methods:
    • Select Individual Employees — pick specific people with a people picker.
    • Filter by Criteria — pick a managed property (Department, Office Location, Job Title, or a custom property via pinnedCriteriaCustomField) plus a value. The criteria value dropdown is populated with distinct values discovered in your tenant.

View Templates

  • Card View (default): responsive grid of profile cards with a circular photo, name, title, department, and location. Email, phone, SIP/Teams, and other contact fields render as circular icon buttons at the bottom of each card.
  • List View: compact row layout where every enabled non-image field becomes a column. The Name field renders as a brand-colored link, email and phone fields render as inline clickable text links, and the profile picture (when enabled) shows as a small avatar in the first column. On narrow viewports the column header row collapses.

Allow view switching

Enable showViewSwitcher to let users toggle between Card and List at runtime.

Profile photo fallback

Photos come from the PictureURL managed property. When that field is empty, the web part falls back to SharePoint’s default profile photo endpoint (/_layouts/15/userphoto.aspx). If the photo still fails to load (e.g., 404), the card or row renders the user’s initials in a circular Fluent UI Persona avatar.

Filtering & Sorting

In Search Directory mode, you can add a toolbar that lets users narrow results with dropdown filters and change sorting. Filters and sort combine with search text and A–Z filtering.

  • Filter dropdowns: Department, Office, Job Title, Company (configured via filterFields)
  • Active filter chips: removable chips with “Clear all”
  • Sort dropdown: Name (A–Z / Z–A), Department, Job Title, Office
  • Exclude non-employee accounts: one toggle to exclude guests/rooms/equipment/shared mailboxes

Exclusion Rules (Graph Mode)

When the directory uses Microsoft Graph (shown as "Active data source: Microsoft Graph" in Page 2 settings), use the Exclusion Rules field to hide employees. Two rule kinds, one per line:

-company:CohnReznick               # drop rows where company contains the value
-department:Terminations Org       # case-insensitive substring match
-title:Contractor                  # any of name, email, department, title, office, company
require:department                 # NEW: drop rows where department is empty/whitespace
require:title                      # NEW: drop rows where title is empty/whitespace

Rule Kinds

KindSyntaxWhat it does
exclude-field:valueDrops rows where the field contains the value (substring, case-insensitive).
requirerequire:fieldDrops rows where the field is empty or whitespace-only. Also pushed server-side as a Graph $filter clause ({field} ne null) so the “Showing X-Y of Z” counter stays accurate. The client-side check still runs as a backstop for whitespace-only values that ne null can't catch alone.

Available Fields

Both rule kinds use the same field tokens:

FieldExclude syntaxRequire syntaxWhat it searches
name-name:valuerequire:nameDisplay name, first name, last name
email-email:valuerequire:emailEmail address
department-department:valuerequire:departmentDepartment
title-title:valuerequire:titleJob title
office-office:valuerequire:officeOffice location
company-company:valuerequire:companyCompany name

Exclude matches are case-insensitive and use contains logic — -name:Admin matches "Administrator", "Admin Account", and "ADMIN". Quotes are optional for values with spaces. The directory automatically URL-encodes special characters (&, +, ?, #, etc.) so values like "First United Bank & Trust" no longer break the underlying Graph request.

Custom Query Filter (SharePoint Search Mode)

When the directory uses SharePoint People Search, use the Custom Query Filter field with KQL (Keyword Query Language) syntax:

-Department:"Terminations Organization" -JobTitle:Contractor -WorkEmail:vendor -SPS-UserType:1

Common KQL Properties

PropertyDescriptionExample
PreferredNameDisplay name-"PreferredName":"Conf Room"
WorkEmailEmail address-WorkEmail:vendor
DepartmentDepartment-Department:"Terminations Organization"
JobTitleJob title-JobTitle:Intern
OfficeNumberOffice location-OfficeNumber:Building-C
SPS-UserTypeUser type (1 = external)-SPS-UserType:1
SPS-HideFromAddressListsHidden from GAL-SPS-HideFromAddressLists:1
SPS-RecipientTypeDetailsMailbox type-SPS-RecipientTypeDetails:=16 (rooms)

KQL property names are case-sensitive. Values with spaces must be quoted. Multiple exclusions can be on one line separated by spaces. Use = for exact match (e.g., -SPS-RecipientTypeDetails:=16).

Which filter system am I using?

Check Page 2 of the web part settings. If it says “Active data source: Microsoft Graph (Azure AD)”, use Exclusion Rules (graphExclusions). If it says “SharePoint People Search”, use Custom Query Filter (queryFilter). The Exclude Non-Employee Accountstoggle works in both modes. In Graph mode, queryFilter is ignored and a warning is logged to the console.

Configure Fields

  • Enable/disable fields, reorder, and choose managed properties
  • Select display type per field (Text, Email Link, Phone Link, Link, Icon + Text, Image)
  • The Display Name you set becomes the column header in List View
  • Reorder fields to control the column order in List View
  • Reset to default if needed

Configure Fields controls List View columns

In List View, each enabled field becomes a column. The Display Name you set in Configure Fields becomes the column header, and the field order controls the column order. Rename fields freely (e.g., "Job Title" to "Role") — the column header updates to match.

Step-by-Step Configuration

1

Navigate to your target page

Go to the page where you want to add the directory (e.g., People, About Us, or a dedicated Directory page).
2

Add a section with appropriate width

Employee Directory works best in a full-width or two-thirds width section to display multiple columns of results.
3

Add the Employee Directory web part

Click the + button, search for "Employee Directory", and add it to your section.
4

Configure the title

Open the property pane and set a title like "Employee Directory", "Find a Colleague", or "Our Team".

Leave blank for a cleaner look if the page title already indicates the purpose.

5

Select display mode

Choose Search Directory (default) or Pinned Employees in the Display Mode section.
6

Configure pinned options (if used)

Pick employees directly or filter by criteria, then set pinned layout (items per row/page).
7

Set items per page

Configure how many employees display per page using the slider. 20-28 is typical for a grid layout.
8

Configure view options

In View & Filter Options, choose a default view (Card or List) and enable “Allow View Switching” if you want users to toggle views.
9

Enable filters and sort

Toggle filter dropdowns (Department/Office/Job Title) and the sort dropdown in View & Filter Options.
10

Set up exclusions (optional)

Open Page 2 of the property pane. If you see conference rooms, shared mailboxes, or external accounts, enable "Exclude Non-Employee Accounts". For specific exclusions, add KQL in Custom Query Filter (SharePoint Search mode) or rules in Exclusion Rules (Microsoft Graph mode).
11

Configure fields

Use Configure Fields to enable/disable fields, change order, and select managed properties.
12

Publish and test

Save and publish. Test by searching for known employees and using the A-Z filter.

Common Configurations

Copy these ready-to-use configurations:

Company Directory

Full directory with all features enabled

Best for: Dedicated People page
Configuration
titleEmployee Directory
itemsPerPage28
displayModeSearch Directory
enableWildcardSearchOn

Department Team Page

Compact directory for team pages

Best for: Department landing pages
Configuration
titleOur Team
displayModePinned Employees
pinnedSelectionModeSelect Individuals
pinnedItemsPerRow4
pinnedItemsPerPage12

Quick People Search

Search-focused minimal directory

Best for: Homepage sidebar widget
Configuration
titleFind a Colleague
searchTextSearch employees...
itemsPerPage8
displayModeSearch Directory

Browse by Name

Alphabetical browsing focus

Best for: Contact directory pages
Configuration
titleStaff Directory
alphabeticalFilterFieldPreferredName
itemsPerPage20
displayModeSearch Directory
fieldConfigJsonName, Role, Location enabled

Filtered Company Directory

Directory with department, office, and role filters

Best for: Large organizations with 200+ employees
Configuration
titleEmployee Directory
displayModeSearch Directory
enableFiltersOn
enableSortDropdownOn
showViewSwitcherOn
enableStandardExclusionsOn
itemsPerPage28

Clean Directory

Excludes conference rooms, contractors, and external users

Best for: Organizations with mixed account types
Configuration
titleEmployee Directory
displayModeSearch Directory
enableStandardExclusionsOn
queryFilter-JobTitle:Contractor
enableWildcardSearchOn

Best Practices

Ensure user profiles are complete

The directory pulls from Azure AD and SharePoint user profiles. Encourage employees to update their profile photos and job titles for best results.

Use on a full-width section for large organizations

For companies with 100+ employees, a full-width layout allows the grid to display more results at once, reducing pagination clicks.

Use the standard exclusions toggle for clean results

Most organizations have conference rooms, shared mailboxes, and external accounts in their directory. Enable enableStandardExclusions to filter these out automatically instead of building custom query transforms.

List View for data-dense directories

For directories with 500+ employees, List View shows more people per screen than Card View and pairs naturally with filters and sorting.

Combine with People Listing for featured staff

Use Employee Directory for the full org, and People Listing on department pages to highlight specific team members or leadership.

Search indexing may affect results

People search relies on SharePoint/Azure AD indexing. New employees may take 24-48 hours to appear in search results.

Troubleshooting

Still need help? Contact Bonzai Support


Reference

Technical details for developers and advanced users.

Property Pane Configuration

Settings are split across two pages in the property pane. Page 1 contains the settings most users need. Page 2 contains advanced settings and adapts based on the detected data source (SharePoint Search vs Microsoft Graph).

Page 1 · General Settings

PropertyTypeDescription
titleTextWeb part title (default: Employee Directory). Leave blank to hide the title and icon row entirely.
titleIconNameIcon PickerFluent UI icon rendered next to the title (default: ContactCard)
itemsPerPageSlider (4-100)Results displayed per page in Search Directory mode (step: 4, default: 28)

Page 1 · Display Mode

PropertyTypeDescription
displayModeChoiceSearch Directory (default) or Pinned Employees
pinnedSelectionModeChoiceSelect Individual Employees or Filter by Criteria
pinnedEmployeesPeople PickerMulti-select people (individual mode only)
pinnedCriteriaFieldDropdownManaged property to filter by in criteria mode (default: Department). Common options are Department, OfficeNumber, and JobTitle. The dropdown is populated with managed properties discovered in your tenant, plus a custom option for arbitrary properties.
pinnedCriteriaCustomFieldTextCustom managed property name. Only used when pinnedCriteriaField is set tocustom.
pinnedCriteriaValueDropdown / TextValue for the selected criteria field. Renders as a dropdown populated with distinct values from your tenant when available, or as a text field while values are loading.

Page 1 · Pinned Layout (Pinned mode only)

PropertyTypeDescription
pinnedItemsPerRowSlider (1-6)Number of employee cards per row (default: 4)
pinnedItemsPerPageSlider (1-50)Employees per page (default: 12)

Page 1 · View & Filter Options (Search Directory mode)

PropertyTypeDescription
templateNameDropdownDefault view: card or list (default: card)
showViewSwitcherToggleAllow runtime view switching between Card and List (default: Off)
enableFiltersToggleShow filter dropdowns above the results (default: Off). Populated from SharePoint Search refiners or Graph aggregation.
enableSortDropdownToggleShow sort dropdown (default: Off). Options: Name A–Z / Z–A, Department, Job Title, Office.

Page 1 · Display Fields

PropertyTypeDescription
fieldConfigJsonCollection (serialized JSON)Field list controlled by the Configure Fields panel. Each field has an ID, label, managed property, display type (text, email, phone, link,icon-text, image), optional icon name, enabled flag, and order.
customFieldsJsonSerialized JSONSecondary storage for user-defined custom fields. Merged into the effective field list at render time. The Reset to Default button in the property pane clears both fieldConfigJson andcustomFieldsJson.

Page 2 · Data Source

PropertyTypeDescription
resultSourceDropdown / TextData source selection (default: auto). Options include “Auto-detect (Recommended)”, named SharePoint Search result sources discovered in your tenant, and “Custom (enter GUID)”. This group is hidden when the data source has been auto-detected as Microsoft Graph.
enableStandardExclusionsToggleExclude external users, conference rooms, equipment mailboxes, shared/team mailboxes, and accounts hidden from the address list (default: On). Works in both SharePoint Search and Microsoft Graph modes.
queryFilterMultiline TextCustom KQL filter appended to every search (e.g., -Department:Contractors). Only shown in SharePoint Search mode; ignored with a console warning in Microsoft Graph mode.
graphExclusionsMultiline TextExclusion rules applied in Microsoft Graph mode. Two rule kinds, one per line: -field:value drops rows whose field contains the value (substring, case-insensitive); require:field drops rows whose field is empty or whitespace-only and is also pushed server-side as a Graph $filter. Supported fields: name, email, department, title, office, company. Only shown when the detected data source is Microsoft Graph.

Microsoft Graph fallback (auto-detect)

Auto-detect probes three SharePoint Search strategies first (Local People Results, the People result source, and KQL-only without a sourceid), then falls back to Microsoft Graph /users if none return people. Graph mode requires admin approval of the solution’s Graph permission request (User.Read.All). When active, the Data Source group on Page 2 showsActive data source: Microsoft Graph (Azure AD).

Page 2 · Search Tuning (SharePoint Search mode only)

PropertyTypeDescription
alphabeticalFilterFieldTextManaged property used for A–Z filtering (default: PreferredName). Falls back to PreferredName automatically if the configured field fails.
enableWildcardSearchToggleAppend * to search terms for partial matches (default: On)
trimDuplicatesTogglePass trimduplicates=true to SharePoint Search (default: Off)
filterFieldsTextComma-separated managed properties for filter dropdowns (default: Department,OfficeNumber,JobTitle,Company). Only meaningful when enableFilters is on.

Page 2 · Customization

PropertyTypeDescription
searchTextTextPlaceholder text for the search box (default: Search)
titleIconUrlTextCustom icon URL that overrides titleIconName. Hidden when title is blank.
additionalLinkTextTextText for an additional link rendered to the right of the title
additionalLinkUrlTextURL for the additional link (opens in a new tab with noopener noreferrer)

Features Checklist

  • Name search (with optional wildcard matching)
  • Alphabetical A–Z filter with automatic fallback to PreferredName if the configured field fails
  • Profile photos from Azure AD / Microsoft 365, with fallback to SharePoint’s user photo endpoint and initials avatar
  • Contact fields: email, work phone, mobile phone, SIP/Teams address (all configurable)
  • Profile links to Delve / SharePoint profile (SP Search mode) or Delve by user id (Graph mode)
  • Pagination (cursor-based when using Microsoft Graph)
  • Pinned Employees mode — individual picker or filter-by-criteria
  • Configurable fields via Configure Fields collection editor with reorder, enable/disable, and custom display types
  • Responsive grid layout (Card view) and dynamic column layout (List view)
  • Runtime view switching (Card/List toggle)
  • Filter dropdowns populated from Search refiners or Graph aggregation
  • Active filter chips with dismiss and Clear All
  • Sort dropdown (Name, Department, Job Title, Office) — applied server-side in SharePoint Search mode; in Graph mode, sort is a hybrid of $orderby plus a client-side scatter-gather merge across cursor pages so non-Name sorts cover the entire population
  • Standard non-employee exclusions toggle (external users, rooms, equipment, shared mailboxes, hidden from GAL)
  • Custom KQL query filter (SP Search) or client-side exclusion rules (Graph)
  • People content class enforcement (contentclass:spspeople) in every search to prevent non-people results
  • Progressive search fallback — retries with reduced selectproperties / sortlist if SharePoint returns 500
  • Microsoft Graph /users fallback when People Search is unavailable

Data Source

Employee Directory talks to two data sources and chooses between them automatically:

  1. SharePoint People Search API (/_api/search/query) — the default. Indexes Azure AD user profiles, SharePoint user profile properties, and Microsoft 365 profile information. Supports KQL query filters, managed property refiners, and configurable result sources.
  2. Microsoft Graph /users — automatic fallback when People Search returns no results or is unavailable. Requires User.Read.All to be approved for the Bonzai 2 package. Supports $filter, $orderby, $search, and cursor-based (@odata.nextLink) pagination.

Migration from Classic

AspectClassicModern
Technologybonzai.min.js + JSOMSPFx + People Search API, with Microsoft Graph fallback
PhotosSharePoint User ProfileAzure AD / M365 Profile
Profile LinksMySiteDelve / SharePoint Profile
Result Source FiltersSite Settings query transformBuilt-in exclusions toggle + custom query filter
View ModesSingle viewCard View + List View with runtime toggle
FilteringBy custom query transform onlyInteractive dropdowns (Department, Office, Job Title)
SortingNot configurableSort dropdown (Name, Department, Job Title, Office)