SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

LINQ4SP - How to create a new item with a lookup to another list?

Well, how do you like our solution to query a list or insert a new item to a list by LINQ4SP? What do you think about it?

What would you tell, if I show you a newer interesting thing? Are you ready? - OK, today surprise is how to insert a lookup reference to another list. See this short demo, or check a piece of code here:

                // Create a new Category
                ProductCategory pc = new ProductCategory()
                {
                    Title = "new product category",
                };

                // Create a new Sub-Category item
                ProductSubcategory pcat = new ProductSubcategory()
                {
                    Title = "new sub category",
                    ProductCategory = pc
        // <<-- WOW! This is a lookup to Categories...
                };

                // Submit our new Sub-Category
                context.ProductCategory.InsertInSubmit(pc);
                context.ProductSubcategory.InsertOnSubmit(pcat);
                context.Submit();

So, how do you like it?...

Posted 05-20-2008 11:44 PM by Agnes Molnar

Comments

OBA, SharePoint and Aghy [MVP] wrote LINQ4SP - How to create a new item with a lookup to another list?
on 05-20-2008 5:44 PM

Well, how do you like our solution to query a list or insert a new item to a list by LINQ4SP? What do

Dew Drop - May 21, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - May 21, 2008 | Alvin Ashcraft's Morning Dew
on 05-21-2008 8:10 AM

Pingback from  Dew Drop - May 21, 2008 | Alvin Ashcraft's Morning Dew

OBA, SharePoint and Aghy [MVP] wrote LINQ4SP - Delete a list item
on 05-25-2008 4:10 PM

OK, let&#39;s play with LINQ4SP again. You can download Beta1 , write a simple query , create a new list

SharePoint MVP Blogs wrote LINQ4SP - How to create a new item with a lookup to another list?
on 06-19-2008 10:02 AM

Well, how do you like our solution to query a list or insert a new item to a list by LINQ4SP? What do

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.