As a SharePoint site owner, you need a quick way to see which contracts are about to expire without opening each file. A custom library view filters documents based on a date column and shows only the items that matter. This article explains how to create a view that highlights contracts expiring within the next 30 days. You will learn the required columns, view settings, and conditional formatting to make the list actionable.
Key Takeaways: Building a Contract Expiration View in SharePoint
- Add a Date column named “Contract Expiration”: Stores the expiration date for each contract document.
- Create a new view with a filter on the Date column: Shows only items where the expiration date is within the next 30 days.
- Apply conditional formatting to the Date column: Highlights expiration dates that are overdue or approaching within 7 days.
What a SharePoint Library View Does and What You Need Before Starting
A library view is a saved set of display settings, filters, and sorting rules for a document library. It does not change the underlying data. Instead, it shows a subset of documents that match your criteria. For expiring contracts, you use a filter to show only documents whose expiration date falls within a specific range, such as the next 30 days.
Before you build the view, you need the following:
- Site owner or member permissions on the SharePoint site where the contract library exists.
- A document library that contains your contract files. If you do not have one, create a new library named “Contracts”.
- A Date column named “Contract Expiration” or similar. The column must use the Date and Time data type with Date Only format. If the column does not exist, you must add it first.
Steps to Build the Expiring Contracts View
Step 1: Add the Contract Expiration Date Column
- Open the document library
Go to the SharePoint site that contains your contract library. Click the library name in the left navigation or on the site home page. - Add a column
Click the column header area at the top of the list. Select Add column and then choose Date and Time. Name the column Contract Expiration. Set the format to Date Only. Leave the default value blank. Click Save. - Fill in dates for existing contracts
For each contract document, edit the properties and enter the expiration date in the Contract Expiration column. This step is required so the view can filter correctly.
Step 2: Create a New View
- Open the view selector
At the top of the library, click the current view name, usually All Documents. Select Create new view from the dropdown. - Choose a view type
Select Standard View. This creates a simple list view that works on desktop and mobile browsers. - Name the view
Enter Expiring Contracts as the view name. Check the box Make this the default view if you want all users to see this view first when they open the library. - Set the filter
In the Filter section, click Show items only when the following is true. In the first dropdown, select Contract Expiration. In the second dropdown, select is less than or equal to. In the value box, enter [Today]+30. This formula shows all documents whose expiration date is today or within the next 30 days. Click OK. - Sort the items
In the Sort section, select Contract Expiration and choose Show items in ascending order. This places the earliest expiration dates at the top of the list. - Choose columns to display
In the Columns section, ensure Contract Expiration is checked. Remove any columns that are not needed, such as Checked Out To or Version. Click Create at the bottom of the page.
Step 3: Apply Conditional Formatting to Highlight Urgent Dates
- Open the column formatting pane
In the library, hover over the Contract Expiration column header. Click the dropdown arrow that appears and select Column settings > Format this column. - Paste the JSON formatting code
In the Column Formatting pane, select Advanced mode. Delete any existing code and paste the following JSON:{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField <= @now, '#ffcccc', if(@currentField <= @now + 2592000000, '#ffffcc', ''))", "padding": "5px" } } - Replace date calculation with readable values
The above JSON uses milliseconds. For a simpler approach, use the following JSON that checks dates against today and today+7:{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField <= @now, '#ffcccc', if(@currentField <= @now + 604800000, '#ffffcc', ''))", "padding": "5px" } }
This highlights overdue dates in light red and dates within 7 days in light yellow. - Apply the formatting
Click Save at the bottom of the pane. The column now shows colored backgrounds based on the expiration date.
Common Mistakes and Limitations When Building Expiring Contract Views
The filter uses a static date instead of [Today]
If you enter a fixed date like "2025-06-01" in the filter, the view will stop working after that date. Always use the [Today] token followed by a plus sign and the number of days. For example, [Today]+30 shows items expiring in the next 30 days. The view recalculates automatically each day.
The conditional formatting does not update
Conditional formatting uses the date value stored in the column. If you edit a contract expiration date, the formatting updates within a few minutes. If the formatting still does not appear, refresh the browser page. Check that the column type is Date and Time and not Single line of text. Text columns cannot use date-based conditional formatting.
The view is not visible to other users
When you create a view, it is visible to all users who have access to the library. If you want only certain users to see the view, you must set view permissions. Go to the view settings page and scroll to the Audience section. Select Create a personal view if you want the view to appear only in your own view selector. Otherwise, leave the default setting to make it public.
Current View vs Filtered View: Key Differences
| Item | Current View (All Documents) | Filtered View (Expiring Contracts) |
|---|---|---|
| Purpose | Shows all documents in the library regardless of expiration | Shows only documents expiring within a defined date range |
| Filter criteria | No filter applied | Uses [Today]+30 or similar dynamic date formula |
| Sort order | Default sort by Name or Modified | Sorted by Contract Expiration ascending |
| Conditional formatting | Optional, not required | Recommended to highlight overdue and approaching dates |
| Use case | General browsing and file management | Proactive contract renewal tracking |
What to Do After Building the Expiring Contracts View
You now have a library view that filters contracts expiring within the next 30 days and highlights urgent dates with color. Share the view with your team by setting it as the default view for the library. To take this further, create an additional view named "Expired Contracts" using the filter Contract Expiration is less than [Today]. This view shows contracts that have already expired and need immediate attention. For advanced users, set up a Power Automate flow that sends an email notification when a contract expiration date is within 7 days. This automated alert removes the need to check the library manually.