Yes/No Column PnP PowerShell

PnP PowerShell: Add Number Column in SharePoint Online

SharePoint Online is a powerful collaboration platform that allows organizations to manage and share content efficiently. One of the key features of SharePoint is its ability to create custom columns to capture specific data types. In this blog post, we will guide you through the process of creating a number column in SharePoint Online using PnP PowerShell.

Prerequisites

Before you begin, make sure you have the following prerequisites in place:

  1. SharePoint Online Environment: You should have access to a SharePoint Online site where you have the necessary 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: You should know the URL of the SharePoint site where you want to create the number column.

Steps to Create a Number Column

Follow these steps to create a number column in SharePoint Online using PnP PowerShell:

Step 1: Connect to SharePoint Online

Open 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 a Number Column

To create a number column, you can use the Add-PnPField cmdlet. Here’s an example of how to create a number column named “Revenue” with specific settings:

Add-PnPField -DisplayName "Revenue" -InternalName "Revenue" -Type Number -List "<ListName>" -Group "<ColumnGroup>"
  • -DisplayName: This is the name that will be displayed for the column in SharePoint.
  • -InternalName: This is the internal name of the column. It should not contain spaces or special characters.
  • -Type: Set this to “Number” to create a number column.
  • -List: Replace <ListName> with the name of the SharePoint list or library where you want to add the column.
  • -Group: Specify the column group where you want to place the new column.

Step 3: Verify the Column

To ensure that the column has been created successfully, you can retrieve a list of all columns in your SharePoint list or library using the following command:

Get-PnPField -List "<ListName>"

Conclusion

Creating a number column in SharePoint Online using PnP PowerShell is a straightforward process. By following the steps outlined in this blog post, you can easily add a number column to your SharePoint site and tailor it to your specific requirements. Custom columns like these can greatly enhance your SharePoint lists and libraries, making them more effective for data management and collaboration within your organization.

Related Posts

Leave a Reply

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