Skip to content

SharePoint Library Notifications for Every New Entry

See how our SharePoint document management app surfaces new library entries, badges open tasks, and keeps REST queries lean with five-minute refreshes.

In our previous deep dive on the document management app, Search Functionality for SharePoint Document Management Application, we showed how we make navigating SharePoint libraries effortless. This time we focus on a favorite usability boost: automated notifications that highlight each new entry in a SharePoint library the moment it appears.

Highlighting New Entries Inside SharePoint Libraries

Our document management app aggregates every entry from the connected SharePoint libraries. One of those libraries tracks each user’s open tasks. To keep work from slipping through the cracks, a red badge inside the interface displays the number of outstanding items—no need to open the list or refresh the page.

Notification for new entries in a SharePoint library

Automatic Badge Refreshes

Whenever a task changes—because someone assigns a new item or completes an existing one—the notification updates itself on a fixed cadence. We rely on the JavaScript setInterval helper to trigger our data fetch every 300,000 milliseconds (five minutes), so users always see a current count.

JavaScript Interval for Badge Updates

private loadOpenTasksCount() {
  // First call without delay
  this.executeLoadOpenTasksCountCommand();

  // Check open tasks every five minutes
  this.interval = setInterval(this.executeLoadOpenTasksCountCommand, 300000);
}

Querying the List Entries

The badge uses a REST query against SharePoint. To keep it fast, we only select the Id field, filter for the signed-in user plus the desired task status, and return the number of matches to the interface.

REST Query with Filter Criteria

public static getOpenTasksCount(): Promise<number> {
  const service: SPRestService = SPServiceProvider.GetCurrentSPService();
  const selectQuery = 'Id';
  const filterQuery = `AssignedToId eq ${AppContext.currentUser.id} and Status eq 'In Progress'`;

  return service
    .getListItemsByFilter(AppContext.taskList, selectQuery, filterQuery)
    .then(items => (items && items.value ? items.value.length : 0));
}

Service Call into the SharePoint Library

public getListItemsByFilter(list: IList, selectQuery?: string, filterQuery?: string) {
  const restAPI = `${this.context.pageContext.web.absoluteUrl}/_api/web/Lists(guid'${list.Id}')/items?${
    selectQuery !== null && selectQuery !== undefined ? `$select=${selectQuery}` : ''
  }${
    filterQuery !== null && filterQuery !== undefined ? `&$filter=${filterQuery}` : ''
  }`;

  return this.context.spHttpClient
    .get(restAPI, SPHttpClient.configurations.v1)
    .then(response => response.json());
}

Takeaways

Visual notifications coupled with lean REST queries ensure SharePoint users understand their workload in seconds while the platform stays responsive. Every new entry is flagged immediately, and the five-minute refresh cadence keeps the badge trustworthy throughout the day.

Related articles

SPFx 1.24: Testing today to help our customers tomorrow
EventBooking in Microsoft 365 Copilot: original product cards with a confirmed registration on the right and a follow-up question about the booked workshop on the left

SPFx 1.24: Testing today to help our customers tomorrow

We are exploring the SPFx 1.24 preview with our existing products. EventBooking in Copilot shows promising early results and gives us practical experience for future customer solutions.

Read more
Provisioning at enterprise scale: PnP templates,

Provisioning at enterprise scale: PnP templates, throttling and race conditions across thousands of libraries

Provision SharePoint at enterprise scale with PnP: handle 429 throttling, idempotency, and ETag-based race-condition protection.

Read more
Website Relaunch: Migrate WordPress to Astro with
Website Relaunch: Migrate WordPress to Astro with Custom Tools

Website Relaunch: Migrate WordPress to Astro with Custom Tools

How we successfully migrated from WordPress to Astro: Custom migration tools, GitHub integration, Azure hosting, and Content-as-Code workflow. Battle-tested solution for modern websites.

Read more

Questions about this topic?

We are happy to help you put this into practice in your environment.