$fix11 = Add-PnPField `
-DisplayName 'Date of Birth' `
-InternalName DateofBirth `
-Type Date `
-Required `
-Group 'Football Content Types'
The Required
parameter doesn't seem to work, any one experiencing the same thing?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this community$fix11 = Add-PnPField `
-DisplayName 'Date of Birth' `
-InternalName DateofBirth `
-Type Date `
-Required `
-Group 'Football Content Types'
The Required
parameter doesn't seem to work, any one experiencing the same thing?
In my test, it working fine. You can go to Site Settings->Site Columns and check this column.
My test script as below.
$URL='https://tenant.sharepoint.com/sites/team'
Connect-PnPOnline –Url $URL –Credentials (Get-Credential)
$fix11 = Add-PnPField `
-DisplayName 'Date of Birth' `
-InternalName DateofBirth `
-Type Date `
-Required `
-Group 'Football Content Types'
I run the script in SharePoint Online Management Shell with the latest PnP PowerShell. I suggest you install the latest PnP PowerShell to check if it works.
Worked for me to with just using the -Required
parameter. Are you running on the latest version of the PnP-PowerShell module?
Try to use a switch and set it to $true
and see if it work's any better. -$Required:$true
.
$fix18 = Add-PnPFieldToContentType `
-ContentType 'Player Bio' `
-Field Club `
-Required
The required field needed to be added to Add-PnPFieldToContentType also. That fixed it!