I need to update an Managed Metadata field Default Value in over 100 libraries .When i first set the value i used the script as shown below .But when i am trying to set the script default value to new value.Its not working .Can some one please guide me with this
$taxField = $list.Fields.GetByInternalNameOrTitle("MyField")
[Microsoft.SharePoint.Client.Taxonomy.TaxonomyField] $txField = [Microsoft.SharePoint.Client.ClientContext].GetMethod("CastTo").MakeGenericMethod([Microsoft.SharePoint.Client.Taxonomy.TaxonomyField]).Invoke($global:ctx, $taxField)
$taxField .DefaultValue = "-1;#MydataField|29ca0c72-1fc4-435f-a09c-28585cb5eac9"
$taxField .Update()
$ctx.Load($taxField)
$ctx.ExecuteQuery()
I noticed one more thing its that the actual value is getting updated but when you go to the column default value settings it shows the old value .But if i upload a new document it actually has the new value .Is there a way that i can fix this .Also only for the managed metadata field it shows this folder for all the other ones it shows the library as shown below