How to Delete a Column in SharePoint List Using PowerShell

How to Delete a Column in SharePoint List Using PowerShell

Last Updated on January 16, 2024

Can you delete site columns using PowerShell?

In this guide, you will learn how to easily delete a column in SharePoint and confirm the deletion using PowerShell scripts.

Let’s get started.

Deleting a Column in the Web Interface

With the modern interface, deleting a site column is as good as clicking a few buttons.

For example, when you edit a column (column properties), you will see a delete button at the bottom.

delete a column from the edit column sidepanel

A small window will then appear asking for confirmation.

After you confirm your decision to delete the list column, the column will then be deleted.

Note: Deleting the column will remove all the data stored in that column permanently.

Sign up for exclusive updates, tips, and strategies

    How to Use PowerShell to Delete a Column

    However, if you’re more used to using PowerShell, you can also opt to use it instead of the web interface.

    Step 1: Identify the List and Column

    The first step is to establish a connection to your SharePoint site.

    Open SharePoint Management Shell or PowerShell and execute the following command:

    Connect-PnPOnline -Url [YourSharePointSiteURL] -Credentials (Get-Credential)

    Make sure to replace [YourSharePointSiteURL] with the URL of your SharePoint site.

    From there, you would need to know the exact name of the list and column to delete.

    Note: Incorrect names can lead to errors or unintended consequences.

    Step 2: Delete the column

    Use the PnP PowerShell Remove-PnPField cmdlet to delete the column from SharePoint Online.

    Replace [ListName] with the name of your list and [ColumnName] with the name of the column you wish to remove.

    Use this PowerShell script:

    Remove-PnPField -List [ListName] -Identity [ColumnName] -Force

    The -Force parameter is optional but useful as it bypasses the confirmation prompt when you delete columns.

    Step 3: Verify the deletion

    It’s good practice to verify that the site column has been successfully deleted.

    You can do this by navigating to the list in the web interface or by using PowerShell to list all columns in the list:

    Get-PnPField -List [ListName]

    Check if the target column was deleted.

    Using PowerShell in SharePoint

    When working with PowerShell for SharePoint administration, precision and a full grasp of your command’s consequences are key.

    PowerShell streamlines SharePoint management but demands careful use.

    If you have more questions about how to delete a column using PowerShell, feel free to leave a comment.

    For further inquiries or any business-related concerns, kindly use the site’s contact form. I’ll respond promptly.

    About Ryan Clark

    As the Modern Workplace Architect at Mr. SharePoint, I help companies of all sizes better leverage Modern Workplace and Digital Process Automation investments. I am also a Microsoft Most Valuable Professional (MVP) for SharePoint and Microsoft 365.

    Subscribe
    Notify of
    guest
    0 Comments
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x
    ()
    x
    Scroll to Top