user2353609
user2353609

Reputation: 21

what is the best way to get all aliases of a specific node in Kentico

Hello Kentico Experts,

What is the best way to get all aliases within a specific node in Kentico and then delete them?

E.g: I need to delete all aliases within "Products" node. There are 5000 products under this node and they may contain aliases.

How to delete them by by an easiest way?

Thanks

Upvotes: 0

Views: 505

Answers (2)

rocky
rocky

Reputation: 7696

As Brenden says, there is no way of mass deletion of document aliases. You'll have to do it via SQL.

This is how you get all aliases for a sub-tree:

SELECT *
  FROM [CMS_DocumentAlias]
  WHERE [AliasNodeID] IN (SELECT NodeID  FROM [CMS_Tree]
  WHERE [NodeAliasPath] LIKE '/Products/%' /*AND NodeSiteID=...*/)

First make a backup of your DB, then check whether the query gives you the desired records and possibly add some more constraints to the where condition (e.g. for site and culture) and when you're happy with the results just replace SELECT * with DELETE.

Upvotes: 3

Brenden Kehren
Brenden Kehren

Reputation: 6117

The best approach without writing any code or running any SQL queries is to use the "List" view (pre v8) and "Listing" view (v8 and newer) within the Content Tree.

If you're node Products is /Products, select the Products node, then click the Listing button at the top of the content tree. In the list mode, at the bottom of the listing, there are 2 dropdown lists. In the first one select "All pages" and in the second one, select "Delete", then click the OK button. This will remove everything needed.

If you wish to destroy all of their history and everything, then go to the Recycle Bin and find all the pages and destroy them permanently.

Upvotes: 2

Related Questions