spmeta2
spmeta2 copied to clipboard
Clear QuickLaunch (remove all nodes)
Hello Do you have plans for creating function to provide availability for removing all quick launch nodes? It's really necessary. Nowadays, we have to use our function out of SPMeta2 model. So, we have to provision web model, clear quick launch with help of our function and then provision model which consist of only quick launch nodes.
There is DeleteQuickLaunchNavigationNodesDefinition
There is DeleteQuickLaunchNavigationNodesDefinition
I know about this. But in this definition you must set NavigationNodeMatch, for example:
.AddDeleteQuickLaunchNavigationNodes(new DeleteQuickLaunchNavigationNodesDefinition
{
NavigationNodes = new List<NavigationNodeMatch>
{
new NavigationNodeMatch { Title = "Home" },
new NavigationNodeMatch { Title = "Recent" },
new NavigationNodeMatch { Title = "Site Contents" }
}
})
But I don't know what exactly navigation nodes would be exist on a web. I need a function to remove all existed nodes, for example:
.AddDeleteAllQuickLaunchNavigationNodes()
Hey guys, sorry for the late response.
Indeed, there are a few options around NavigationNodeMatch class but all of them require knowing what the target node is - either by Title or Url.
We have two options here: add a new definition such as suggested . AddDeleteAllQuickLaunchNavigationNodes(), or extend NavigationNodeMatch to work with regexp so that Title/Url match would work across multiple nodes.
Having said that, we tend to go the second way enhancing NavigationNodeMatch class with regexp. That way, we would be able to expose a custom syntax such as . AddDeleteAllQuickLaunchNavigationNodes() via constructing NavigationNodeMatch class with a star-based regexp as "*" - like, delete everything.
Let us know what's your view on that, we'll see how fast it can be added to the library. Again, sorry for the late response.
Good idea!
Alright, we can do that. What's your ETA? When do you need it?
Not very urgently. So, it's up to you.
Noted, thank you.
How is the rest? Anything else we can improve? All good?
I think all good. It's enough for this time :) It's really cool idea about regexp in NavigationNodeMatch. But there should be a default function .AddDeleteAllQuickLaunchNavigationNodes() in SPMeta2 with preconfigured regexp "*" in NavigationNodeMatch, because you intuitively try to find something like AddDeleteAllQuickLaunchNavigationNodes().
Right, makes sense. Not sure if we need to implement this as a separate definition or as an additional syntax. We'll think about that and either way, implement it.