Daily Archives: January 31, 2012

Adding to a SharePoint 2010 List with Lookups

I had a situation recently where I was building a form in SharePoint 2010. I used a main list for the form and several other lists as lookup values for some of the fields. I used a .NET User Control for the UI, and SPMetal and LINQ to interact with SharePoint. This was my first time using SPMetal, and I had trouble adding items to the main list. The error was coming from the lookup fields. I eventually figured out that you can’t assign lookup field values to an item while you are adding it. You have to create the item first without the lookup values, then go back and add them.

Posted in Development, Linq to SharePoint, SharePoint 2010 | Tagged , , | Leave a comment