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

This question is related to my issue described here: SharePoint 2010 Performance troubleshooting

On SP 2010: Does anyone knows if there is some performance limitations while using SPListItemVersionCollection?

Scenario: List with 3-4K items with unique item permissions and many versions (~5-60 per item).

When executing:

 foreach (SPListItemVersion version in spItem.Versions){...}

It takes just too long...

This code was used in IHttpModule so maybe this is reason why it takes too long but I am wondering if there is some general issue with SPListItemVersionCollection that I am not aware of.

share|improve this question
    
Sorry to break your tumbleweed record, but did you ever find an answer to this? I am experiencing the same problem. –  CigarDoug Aug 5 '13 at 16:30
    
You can limit the fields you're getting by using the workaround: slavensemper.blogspot.com/2013/12/splistitem-with-too-many.html –  user21336 Dec 11 '13 at 8:41
    
Please provide more than a link as an answer. If the link breaks, your answer will be of very little help! :) –  Robert Lindgren Dec 11 '13 at 9:31

1 Answer 1

Instead of placing the spItem.Versions in foreach statement. out the versions in a variable.

var versions =  spItem.Versions;
foreach(var item in versions) {}

because whenever you call spItem.Versions, SharePoint will make a call to get all the versions.

share|improve this answer

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.