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 - Delete a list item

OK, let's play with LINQ4SP again.

You can download Beta1, write a simple query, create a new list item and lookup fields. In the next part I'll show you how to delete an item from a list:

        [TestMethod]
public void DeleteCreatedItems()
{
using (AwContext context = new AwContext())
{
var q = from subCategory in context.ProductSubcategory
where subCategory.Title == "new sub category"
select subCategory;

foreach (ProductSubcategory psubcat in q) psubcat.DeleteOnSubmit();


var p = from product in context.Product
where product.ProductNumber == "AA" ||
product.ProductNumber == "Double test" ||
product.ProductNumber == "Date test"
select product;
foreach (Product prod in p) prod.DeleteOnSubmit();

var z = from pc in context.ProductCategory
where pc.Title == "new product category"
select pc;
foreach (ProductCategory prodcat in z) prodcat.DeleteOnSubmit();

context.Submit();
}
}

Posted 05-25-2008 10:53 PM by Agnes Molnar

Comments

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

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

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

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

SharePoint MVP Blogs wrote LINQ4SP - Delete a list item
on 06-19-2008 10:02 AM

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

... wrote re: LINQ4SP - Delete a list item
on 03-14-2009 8:21 AM

Sehr wertvolle Informationen! Empfehlen!

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.