locked
Workflow New Or Updated Item? RRS feed

  • Question

  •  

    Hello,

    I am trying to find out how to determine programmatically if a workflow within SharePoint was fired off because a new item was added to a list or because an existing item was updated. If it is relevant, I am using WSS 3.0 and Visual Studio 2008. Any suggestions are appreciated.

    Thanks!
    Justin

    Thursday, December 6, 2007 3:22 PM

Answers

  • I guess you could compare the creation time of the workflow item with it's modification time:

     

    Code Block

    if (workflowProperties.Item[SPBuiltInFieldId.Created]

    == workflowProperties.Item[SPBuiltInFieldId.Modified])

    {

    //new item

    }

    else

    {

    //updated item

    }

    Friday, December 7, 2007 2:39 AM

All replies

  • I guess you could compare the creation time of the workflow item with it's modification time:

     

    Code Block

    if (workflowProperties.Item[SPBuiltInFieldId.Created]

    == workflowProperties.Item[SPBuiltInFieldId.Modified])

    {

    //new item

    }

    else

    {

    //updated item

    }

    Friday, December 7, 2007 2:39 AM
  •  

    Thanks - that did the trick.
    Friday, December 7, 2007 3:22 PM