SOLVED

Update "CanToggleHidden" Property - SPO

Copper Contributor

In SPO, I'm trying to delete a "Managed Metadata" column in a library but getting the below error in UI and also in PowerShell:

 

Error: Cannot change Hidden attribute for this field

 

On googling, I found that "CanToggleHidden" property has to be set to "True" and then "Hidden" property has to be set to "False" to fix this issue. So,I executed the below PS Script to apply these changes:

 

$SiteURL = "https://ABC.sharepoint.com/sites/Intranet"
$ListName = "Site Pages"
$FieldName = "CandC_Color" #Internal Name
Try {
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWeblogin
#Set Field Properties
Set-PnPField -List $ListName -Identity $FieldName -Values @{CanToggleHidden="True";Hidden=$False}   
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}

 

While executing this PS script I get the below error and not able to delete the "Managed Metadata" column

 

> WARNING: No property 'CanToggleHidden' found on this field. Value will be ignored.

 

Kindly assist on this issue and guide if there are any other options to delete the column?

3 Replies
best response confirmed by George91288 (Copper Contributor)
Solution

Hi!

So CanToggleHidden doesn't exist in SharePoint online.

try this :

Make it hidden or Visible:

Set-PnPField -List $ListName -Identity $FieldName -Values @{Required=$False;Hidden=$False}

 

Delete Field:

Remove-PnPField -List $ListName -Identity $FieldName

 

@NicholasKheirallah This didnt work. I am still getting the same error "Error: Cannot change Hidden attribute for this field" while trying to delete the column using Remove-PnPField

Do a Get-PnPField on that field and post the output. Sounds like it might have an different internal name?
1 best response

Accepted Solutions
best response confirmed by George91288 (Copper Contributor)
Solution

Hi!

So CanToggleHidden doesn't exist in SharePoint online.

try this :

Make it hidden or Visible:

Set-PnPField -List $ListName -Identity $FieldName -Values @{Required=$False;Hidden=$False}

 

Delete Field:

Remove-PnPField -List $ListName -Identity $FieldName

 

View solution in original post