2

In Sitecore 10.1 the system items in core / master DB cannot be moved or deleted. It is possible to hide these from non-admin users with security, but is it possible to hide these from admin users? Or ideally delete them totally? The use case here is items in Marketing Control Panel - there are a lot of stock items that don't make sense for the client.

3 Answers 3

3

The resource items that got introduced in 10.1 cannot be deleted. I would assume Sitecore had a reason to do so - those items are not in a database anymore but in a (resource) file so it's probably not such a good idea to edit those (as that is the whole point of the change - those files should not be edited).

You can make changes and those will be saved in the database, but there is no mechanism to delete them. And I guess this makes some sense, although I do understand your question as we were used to be able to do that.

But this brings me to a question about your security setup: why would you hide those from admins? People with admin rights see everything. If items from a marketing control panel don't make sense to someone, that person should not be an admin. So my suggestion for you is to actually rethink your security setup - editors should not be admins...

1

These items are loaded from the protobuf file by Sitecore.Data.DataProviders.ReadOnly.Protobuf.ProtobufDataProvider which is located in the Sitecore.Kernel assembly. The ProtobufDataProvider exposes several methods and properties which can be overridden. For example there is public override ItemsDataSet DataSet which exposes all the items loaded from the protobuf file. A possible solution could be to inherit ProtobufDataProvider, override this property and remove items you don't want. This provider then has to be patched in.

PS. I agree with some of the other answers here that in this case there might be better alternate solutions, however there are arguably other scenarios which require such a solution, which is why Sitecore marked these methods as overridable.

Update: a possible implementation can be found on my blog, it is a little long to post here

-1

Normally Sitecore Admin can delete any items from Sitecore. Have you checked if items you cannot delete are protected? You can unprotect the items, then you can delete them. Also you should be able to delete them from code for sure using Sitecore API. enter image description here

2
  • 2
    This will not work on 10.1 since the Sitecore system items come from a read-only protobuf file, they are no longer in SQL
    – Mark Cassidy
    Commented Apr 15, 2021 at 10:18
  • @MarkCassidy thanks for the update Commented Apr 15, 2021 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.