spmeta2 icon indicating copy to clipboard operation
spmeta2 copied to clipboard

Clear QuickLaunch (remove all nodes)

Open vlad-ivanov-d opened this issue 7 years ago • 9 comments

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.

vlad-ivanov-d avatar Jun 07 '17 07:06 vlad-ivanov-d

There is DeleteQuickLaunchNavigationNodesDefinition

digital88 avatar Jun 10 '17 11:06 digital88

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()

vlad-ivanov-d avatar Jun 10 '17 11:06 vlad-ivanov-d

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.

SubPointSupport avatar Jun 13 '17 00:06 SubPointSupport

Good idea!

vlad-ivanov-d avatar Jun 13 '17 07:06 vlad-ivanov-d

Alright, we can do that. What's your ETA? When do you need it?

SubPointSupport avatar Jun 13 '17 07:06 SubPointSupport

Not very urgently. So, it's up to you.

vlad-ivanov-d avatar Jun 13 '17 07:06 vlad-ivanov-d

Noted, thank you.

How is the rest? Anything else we can improve? All good?

SubPointSupport avatar Jun 13 '17 11:06 SubPointSupport

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().

vlad-ivanov-d avatar Jun 13 '17 11:06 vlad-ivanov-d

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.

SubPointSupport avatar Jun 14 '17 01:06 SubPointSupport