1. Access an Item

Access system items

Version:

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:

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

Sitecore.Data.Items.Item mediaRoot = master.GetItem(Sitecore.ItemIDs.MediaLibraryRoot);
If you have suggestions for improving this article, let us know!