You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is an issue or working 'as designed' -- seems to me that the cmdlet is not working correctly. I am attempting to set the formula for a site column (which is also used in a library) via PnP Powershell. My code is as follows and works without throwing an error:
$listName="Library1"
$fieldName="Archive Status"
$formula="=IF([Archive File]=""No"",""Archive"",(IF(AND([Archive File]=""Yes"",[Archive Processed]=FALSE),""Archiving in Progress"",""Archived"")))"
After this code executes, when I check the column in the library, the formula is correctly updated and shows this formula (as expected):
=IF([Archive File]="No","Archive",(IF(AND([Archive File]="Yes",[Archive Processed]=FALSE),"Archiving in Progress","Archived")))
However, when I check the column at the site level, it shows the following:
=IF(#NAME?="No","Archive",(IF(AND(#NAME?="Yes",#NAME?=FALSE),"Archiving in Progress","Archived")))
Is this expected behavior? The columns that the formula references are all available site columns, so they are there. Is it not possible to update a site column at the site level using Set-PnPField?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this is an issue or working 'as designed' -- seems to me that the cmdlet is not working correctly. I am attempting to set the formula for a site column (which is also used in a library) via PnP Powershell. My code is as follows and works without throwing an error:
$listName="Library1"
$fieldName="Archive Status"
$formula="=IF([Archive File]=""No"",""Archive"",(IF(AND([Archive File]=""Yes"",[Archive Processed]=FALSE),""Archiving in Progress"",""Archived"")))"
$field = Get-PnPField -List $listName -Identity $fieldName
[xml]$schemaXml=$field.SchemaXml
$schemaXml.Field.Formula=$formula
Set-PnPField -Identity $fieldName -Values @{SchemaXml=$schemaXml.OuterXml} #Update site column
Set-PnPField -List $listName -Identity $fieldName -Values @{SchemaXml=$schemaXml.OuterXml} #Update list column
=======================================
After this code executes, when I check the column in the library, the formula is correctly updated and shows this formula (as expected):
=IF([Archive File]="No","Archive",(IF(AND([Archive File]="Yes",[Archive Processed]=FALSE),"Archiving in Progress","Archived")))
However, when I check the column at the site level, it shows the following:
=IF(#NAME?="No","Archive",(IF(AND(#NAME?="Yes",#NAME?=FALSE),"Archiving in Progress","Archived")))
Is this expected behavior? The columns that the formula references are all available site columns, so they are there. Is it not possible to update a site column at the site level using Set-PnPField?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions