private void Page_Load(object sender, System.EventArgs e)

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

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

// the ID of the "Simple" workflow

string workflowID = "{A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}";

// checking all children of the rootItem

foreach (Sitecore.Data.Items.Item item in rootItem.Children)


// getting the current workflow state of the item

string stateName = GetState(item, master, workflowID).DisplayName;

// if the item is in the "Done" state, outputting its name

if (stateName == "Done")






private Sitecore.Workflows.WorkflowState GetState(Sitecore.Data.Items.Item item,

Sitecore.Data.Database database,

string workflowID)


// getting the workflow provider for the master database

Sitecore.Workflows.IWorkflowProvider provider = database.WorkflowProvider;

// getting the Simple workflow through the IWorkflow interface

Sitecore.Workflows.IWorkflow iWorkflow = provider.GetWorkflow(workflowID);

return iWorkflow.GetState(item);