Skip to content

[BUG] Add-PnpField does not accept parameter ReturnType, even if used with Type=Calculated #3503

@zenlord

Description

@zenlord

Error encountered = "Error: A parameter cannot be found that matches parameter name 'ReturnType'."

The documentation clearly mentions the parameter "ReturnType" for the cmdlet Add-PnpField, provided the "Calculated" type is set as well.

This is failing:
Add-PnPField -DisplayName $ctTypeField.Displayname -InternalName $ctTypeField.Name -Type $ctTypeField.Type -Formula $ctTypeField.Formula -ReturnType $ctTypeField.ReturnType -Group "Contract Columns"

While removing the ReturnType parameter and value from the command works as expected (but sets the OutputType to "Text").

Seeing that there is a value 'OutputType' in the output for Get-PnpField, I have also tried using the parameter "-OutputType" instead of "-ReturnType", but that failed as well (to be expected, I guess, as this is not documented)

I also tried using Set-PnpField to set the value of "OutputType" after adding the field, but that failed with an warning that I should not use the string "Number": "WARNING: Setting property 'OutputType' to 'Number' failed with exception 'Object of type 'System.String' cannot be converted to type 'Microsoft.SharePoint.Client.FieldType'.'. Value will be ignored."

What is the version of the Cmdlet module you are running?

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 2.2.0 PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnPFolder…}

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions