title: Can I loop a list in SharePoint with Visual Studio?
body: <p>(Using SharePoint 2010)</p>
  
  <p>Hi guys, I'll try to give enough background for this to make sense.</p>
  
  <p>Basically we have a list of customers with their phone numbers and other info. This list is sorted by an overdue date. We have telemarketer staff that call the customers in this list. So far we've had only one telemarketer calling the customers in the list which presents no problems. Now however we want to have two tm's calling customers in the list, and possibly more in the future. Of course the problem is we don't want them calling the same customers at the same time.</p>
  
  <p>We can solve this by assigning tm's to each customer in the list, then they only see the customers they are assigned to. But since we want to call them in a certain order we would want to assign the tm's in order as well, for example:</p>
  
  <p>Assume we have 3 tm's calling. The list would ideally look as follows (TM1, 2, and 3 are the tm's that would be assigned to that customer):</p>
  
  <ul>
  <li>Cust#1 - TM1</li>
  <li>Cust#2 - TM2</li>
  <li>Cust#3 - TM3</li>
  <li>Cust#4 - TM1</li>
  <li>Cust#5 - TM2</li>
  <li>Cust#6 - TM3</li>
  <li>Cust#7 - TM1</li>
  <li>Cust#8 - TM2
  ... and so on.</li>
  </ul>
  
  <p>Now the trick is that some days we may have 1 tm calling, or 3 tm's calling. So each morning before they begin the tm admin would have to assign the calls to different tm's. This get's tricky when there's 1000+ cusomters in the list. Sure we could switch the list to data view and copy and paste values in from an Excel sheet to make the assignments. Or we could open it in Access and run a script against it. But is there a way I could program a workflow (or something) in Visual Studio to loop through the list for me and do this? I would need to provide it a number representing how many tm's would be calling and then it would loop through the list of customers and assign the tm's in the fashion designated above.</p>
  
  <p>If you can think of a better way to do this I'm open to other ideas too. Thanks in advance!</p>