3

Given a particular item and a particular workflow state, how can I get the date and time that it entered that workflow state in code?

4

1 回答 1

4

You should take a look at GetHistory method of Sitecore.Workflows.HistoryStore class. It's an abstract class, and its only implementation in clean Sitecore is Sitecore.Data.SqlServer.SqlServerHistoryStore.

The GetHistory method accepts the item, and returns a list of WorkflowEvent elements. Each element contains old state, new state, user who did the action, the user's comment and the date. Obviously, that's the date when the state was changed.

Sorry, don't have a sample for you right now, but I hope this hint is helpful.

于 2012-12-06T15:28:07.233 回答