Skip to main content

Access system fields

Abstract

How to access system fields using the Sitecore.FieldIDs class.

You can use the Sitecore.FieldIDs class to access system fields. For example, to access the archive date field of the /Sitecore/Content/Home/Sample item in the Master database:

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

Sitecore.Data.Items.Item sample = master.GetItem("/sitecore/content/home/sample");

Sitecore.Data.Fields.DateField archiveField =

sample.Fields[Sitecore.FieldIDs.ArchiveDate];

DateTime archiveWhen = archiveField.DateTime;