Yes/No Column PnP PowerShell

PnP PowerShell: Add Date & Time Column in SharePoint Online


SharePoint Online is a powerful collaboration and document management platform that allows organizations to store, organize, and share their content. One of the key features of SharePoint is its ability to define custom site columns to capture specific types of data. In this blog post, we will explore how to create a Date & Time site column using PnP PowerShell in SharePoint Online. This can be particularly useful when you want to track important dates or events within your organization.


Before diving into the tutorial, ensure you have the following prerequisites in place:

  1. SharePoint Online Environment: Access to a SharePoint Online site with sufficient permissions to create columns.
  2. PnP PowerShell: Install the PnP PowerShell module if you haven’t already. To setup the PnP PowerShell Module, you can follow another blog post written by me at PnP PowerShell: How to get started? – Hemant Kabra
  3. SharePoint Site URL: Know the URL of the SharePoint site where you want to create the Date & Time column.

Steps to Create a Date & Time Column

Follow these steps to create a Date & Time column in SharePoint Online using PnP PowerShell:

Step 1: Connect to SharePoint Online

Let’s kick things off! Firstly, ppen PowerShell and connect to your SharePoint Online site using the Connect-PnOnline cmdlet. Replace <YourSiteUrl> with the URL of your SharePoint site:

Connect-PnOnline -Url "<YourSiteUrl>"

You will be prompted to log in with your SharePoint Online credentials.

Step 2: Create the Date & Time Column

Now that you’re connected to your SharePoint Online site, you can create a Date & Time site column using the Add-PnPField cmdlet. Here’s an example of how to create a Date & Time column named “EventDate”:

Add-PnPField -DisplayName "Event Date" -InternalName "EventDate" -Type DateTime

In this command:

  • DisplayName: Specify the display name for the column (how it will appear in SharePoint).
  • InternalName: Specify the internal name for the column (used in the column’s URL and code). Make sure it’s unique within the site.
  • Type: Set the column type to DateTime for a Date & Time field.

Step 3: Verify and Use the Date & Time Column

Before concluding, make a quick visit to your SharePoint list to confirm that the “Event Date” column has been seamlessly integrated. Further customization options are at your disposal, such as validation rules, default values, or formatting adjustments, depending on your unique requirements.


In summary, this tutorial has walked you through the process of creating a Date & Time site column in SharePoint Online using PnP PowerShell. Custom site columns empower you to tailor your SharePoint environment, enhancing data consistency and usability. Whether you need to track project deadlines, event dates, or any other time-related information, the ability to create Date & Time site columns is a valuable skill for SharePoint administrators and power users. By following these steps, you can optimize your SharePoint experience and streamline date tracking with ease.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *