0
# CREATES NEW FIELDS FOR PLAYER BIO CONTENT TYPE
Add-PnPField `
  -DisplayName 'Squad Number' `
  -InternalName SquadNumber `
  -Type Number `
  -Required:$true `
  -Group 'Football Content Types'

I can't get the required parameter to actually work, it still says this field is not required when running my PowerShell script. Any advice to get this working? -Required:$true is set to true?

2
  • 1
    i think it should be Required $true , i.e replace colon with space or simply specify -Required Commented Nov 25, 2019 at 9:19
  • Thank you will give it a go :)
    – BennKingy
    Commented Nov 25, 2019 at 9:23

1 Answer 1

1

Try below code:

# CREATES NEW FIELDS FOR PLAYER BIO CONTENT TYPE
Add-PnPField `
  -DisplayName 'Squad Number' `
  -InternalName SquadNumber `
  -Type Number `
  -Required $true `
  -Group 'Football Content Types'

OR (As given here),

# CREATES NEW FIELDS FOR PLAYER BIO CONTENT TYPE
    Add-PnPField `
      -DisplayName 'Squad Number' `
      -InternalName SquadNumber `
      -Type Number `
      -Required `
      -Group 'Football Content Types'

official documentation: Add-PnPField - Check -Required under Parameters section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.