1

I usually use SharePoint Manager 2013 in order to delete taxonomy fields, so I can delete the hidden note field along with it, i.e. a field called Organization and Organization_0. In my production environment, with 2 app and 2 WFE servers, the SharePoint manager is not listing up the web applications. Any ideas about what I could do here to make it list the web applications?

Since I cannot see the web applications in SP manager in order to delete the taxonomy fields, I thought about using Powershell to delete taxonomy fields. Here I need some scripting help on how to delete the hidden field along with the taxonomy field.

I am using SP 2013 on-prem.

2

Try below the Code, it will delete the taxonomy field with hidden note field. Deleting Managed Metadata Fields via PowerShell

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

#Clears up the site columns for the management system
function CleanUpSiteColumns($siteColl, $group){

    $siteColumns = $siteColl.RootWeb.Fields | Where-Object{$_.Group -eq $group}
    foreach($siteColumn in $siteColumns)
    {
        $noteFieldId = $null

        Write-Host "Deleting " $siteColumn.Title

        #If it is a taxonomy field, get the id of the hidden note field
        if($siteColumn.GetType().Name -eq "TaxonomyField")
        {
            #TaxtField holds the Id of the hidden notes field            
            $noteFieldId = $siteColumn.TextField
        }

        #Delete the Site Column
        $siteColumn.Delete()
        #Write-Host $noteFieldId


        #If notes field is there, find it and delete it as well
        if($noteFieldId -ne $null)
        {
            $noteFields = $siteColl.RootWeb.Fields | Where-Object {$_.Id -eq $noteFieldId }
            if($noteFields -ne $null)
            {
                #Find the column
                foreach($noteField in $noteFields)
                {
                    Write-Host "Deleting " $noteField.Title
                    $noteField.Delete()
                }
            }
        }
    }
}

call the function

$siteCollection = Get-SPSite http://demo.sp2013.local

CleanUpSiteColumns $siteCollection "My Taxonomy Columns"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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