I'm trying to delete a field (site column bound to managed metadata) in a view with the following powershell script:
$spWeb = Get-SPWeb -identity http://servernamehere/docs/test/sitename
$spView = $spWeb.GetListFromUrl("/EMails/Forms/AllItems.aspx")
$spField = $spView.Fields["Document Author"]
$spView.ViewFields.Delete($spField["Document Author"])
$spView.Update()
I get this error on line2: v Exception calling "GetListFromUrl" with "1" argument(s): "Cannot complete this action.
Please try again." At line:1 char:32 + $spView = $spWeb.GetListFromUrl <<<< ("/EMails/Forms/AllItems.aspx") + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
What am I doing wrong?
Thanks