mardi 13 janvier 2015

Deleting Search Nav node in powershell CSOM



I have created a script that adds my search nav to my search site but it is still left with what was already there as out of the box. I am having trouble with finding how I can delete the nodes I don't want. Here is my code at the moment :



$Navigation = $ctx.Web.Navigation
$searchNavigation = $Nav.GetNodeById(1040);
$nodeC=$searchNavigation.Children
$ctx.Load($nodeC)
$ctx.ExecuteQuery()
foreach ($Node in $nodeC)
{
$Node.DeleteObject()


}


this doesn't delete the nodes, just give the error Error while creating search result page. Error -->> The collection was modified. Enumeration operation may not execute








0 commentaires:

Enregistrer un commentaire