Access system items

Version: 10.4

You can use members of the Sitecore.ItemID class to access system items without hard-coding paths. For example, to access the /Sitecore/Media Library item in the Master database:

RequestResponse
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");

Sitecore.Data.Items.Item mediaRoot = master.GetItem(Sitecore.ItemIDs.MediaLibraryRoot);

Do you have some feedback for us?

If you have suggestions for improving this article,