Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to detect changes with each on each item update, )but i don't want to use the before, after properties )

My question is:

If i enable list versioning can i diff 2 versions to detect changes, what would be the performance impact? (storage, versions retrieval)

Thanks!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

It depends on which technique you plan to use:

  • Event Handlers - use ItemUpdating having properties object contains the collections BeforeProperties and AfterProperties that helps you to find out what has changed for your item, i.e. compare properties.BeforeProperties[].ToString() with properties.AfterProperties[].ToString(). You can also modify the value of the fields in AfterProperties to affect what is actually stored in the list.

  • SPD Workflows - use the Activity "Wait for field change" and the you could compare the 2

If you need to handle it across versions use something similar to

 if ((item.Versions!= null) && (item.Versions.Count > 0))
        {
                     SPListItemVersionCollection versions = item.Versions;
//work with through the colection

}
share|improve this answer
    
What is the performance hit on versions? –  Zapacila Aug 10 '12 at 13:51
    
Haven't really benchmark it, but you actually retrieving ListItems –  C. Marius - MVP Aug 10 '12 at 14:56
    
Thanks! i hope the DB won't get huge –  Zapacila Aug 10 '12 at 16:37
    
Actually that is already optimized upon extraction of versions per item, but is worth running some benchmarking if you really do a lot of operations on versions –  C. Marius - MVP Aug 10 '12 at 17:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.