Default Value for Sharepoint List Column Value (NOT document library) - PNP PowerShell

Mark Gorelyk 61 Reputation points
2022-02-28T16:00:33.02+00:00

Dear all,

could you advice how to set a default column value for a SharePoint list? I am aware of Set-PnPDefaultColumnValues for document libraries, but what would work with a list?
My use case: List with quite a lot of columns which all need the same value as the default. Any way round doing this manually?

Regards

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yi Lu_MSFT 17,471 Reputation points
    2022-03-01T01:40:41.367+00:00

    Hi @Mark Gorelyk
    You could set default value for column here:

    178646-image.png

    You could also meet your requirement using pnp:

    $SiteURL = "https://Crescent.sharepoint.com"  
    $ListName = "Team Documents"  
    $ColumnName = "color"   
    $DefaultValue = "1"  
       
    #Connect to PnP Online  
    Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
       
    #Set Default Value for the field  
    Set-PnPField -Identity $ColumnName -List $ListName -Values @{DefaultValue=$DefaultValue}  
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful