Forum Discussion

Alex Gonsales's avatar
Alex Gonsales
Brass Contributor
Oct 30, 2017

Expand and document functionality for Add-PnPField and Add-PnPTaxonomyField

There is zero documentation and examples for -FieldOptions for both Add-PnPField and Add-PnPTaxonomyField.

 

I'm trying to use both cmdlets above to add Site Columns to my webs, right now I can't set the "Maximum Characters" when creating a Text field (not available for Add-PnPField), and it is not even possible using something like this:

 

$x = Add-PnPField -DisplayName "Test" -InternalName Test -Type Text
$x.Length = 50   // there is no such property for Site Columns
$x.Update()

How do I set the max characters now?

 

And I'm also trying to use Set-PnPField to accomplish the same will fail, there is no MaxLength, Length, or even Maximum, I can't find any way to set up the maximum number of characters for a site column.

 

The other problem I have, while trying to use Add-PnPTaxonomyField, I would like to use -FieldOptions to set up the defaultValue of the new site column, and also use its other Field Options, but I can't find any examples on the internet.

 

Would be extremely good to have a parameter "-DEFAULTVALUE" for both cmdlets to define the default value for new site columns, and also "-MAXLENGHT", both cmdlets are very useful seems to be barely complete in their current state.

Resources