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 have an Microsoft Office 2010 AddIn which imports Data into SharePoint. The tool creates a Dictionary with over 5000 Values. Every Value is a C#-Class with Data and represents a SharePoint List Item. Because there are lookup relationships between almost all Dictionary-Values (ListItems) i use two loops:

  • in the first loop I create the ListItems and write back the generated ListItemIDs into the Dictionary
  • in the second loop I already have IDs for all ListItems and update the Lookups for all theese created ListItems

Is there a way to minimize the number of my queries ( in worst case scenario there are 5000 ExecuteQuery() for the first loop + 5000 for the second).

share|improve this question

1 Answer 1

A little-known and definitely under-used method is SPWeb.ProcessBatchData. Use this to really effectively perform operations in bulk - I still think there's a limit to what can be done at once, but depending on the schema of your lists this could still be the most efficient way (most definitely in terms of requests sent).

share|improve this answer
    
Thank you James, in this case, my code will run on the client side (MS Visio Client) and I think, I can't use Server Object Model. –  user615993 Feb 26 '13 at 6:31

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.