Search This Blog

Wednesday, June 30, 2010

Efficiently Delete / Purge All Items from a SharePoint List

private static
StringBuilder BuildBatchDeleteCommand(SPList spList)
    {

        
StringBuilder sbDelete = new StringBuilder();


   
sbDelete.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Batch>");

      
string command = "<Method><SetList Scope=\"Request\">" + spList.ID +


"</SetList><SetVar Name=\"ID\">{0}</SetVar><SetVar Name=\"Cmd\">Delete</SetVar></Method>";

     


        foreach (SPListItem item in spList.Items)

        {

           sbDelete.Append(string.Format(command, item.ID.ToString()));


       }

       sbDelete.Append("</Batch>");

       return sbDelete;


  }

22 comments:

  1. Hi there I am so delighted I found your webpage,
    I really found you by mistake, while I was browsing on Google for something else, Regardless I am here now and would
    just like to say kudos for a marvelous post and a all round entertaining blog (I
    also love the theme/design), I don’t have time to read it all at the moment but I have bookmarked it and also added your RSS feeds, so when I have time I will be back
    to read a great deal more, Please do keep up the
    awesome jo.

    Review my blog ... www.parkingsensorsessex.co.uk

    ReplyDelete
  2. I have been surfing online more than 4 hours today,
    yet I never found any interesting article like yours. It's pretty worth enough
    for me. Personally, if all website owners and bloggers made good content as you did, the web will be much more
    useful than ever before.

    Feel free to surf to my weblog :: noclegi radom

    ReplyDelete
  3. Hi there, just became alert to your blog through Google, and found that it's truly informative.
    I am gonna watch out for brussels. I'll appreciate if you continue
    this in future. Many people will be benefited
    from your writing. Cheers!

    Feel free to surf to my web blog - latest iphone games 2013

    ReplyDelete
  4. Your means of telling everything in this post is genuinely good, all be able
    to simply know it, Thanks a lot.

    Feel free to surf to my web page: latest games on iphone

    ReplyDelete
  5. I'm not positive the place you are getting your information, but
    great topic. I needs to spend some time learning much more or working
    out more. Thanks for wonderful information I used
    to be on the lookout for this information for my mission.

    Feel free to surf to my homepage - T-Rex Muscle Building

    ReplyDelete
  6. Pretty! This was a really wonderful article.

    Thank you for supplying this info.

    Here is my weblog: latest iphone 5 games

    ReplyDelete
  7. Wonderful website. A lot of helpful information here.
    I'm sending it to a few buddies ans additionally sharing in delicious.

    And obviously, thanks on your effort!

    Here is my page ... latest iphone games 2013

    ReplyDelete
  8. Excellent post. I was checking continuously this blog and I am impressed!
    Very helpful info specifically the last part :) I care for
    such information much. I was looking for this particular information for a long time.
    Thank you and best of luck.

    Visit my blog post - systemy wystawiennicze

    ReplyDelete
  9. Please let me know if you're looking for
    a writer for your blog. You have some really good articles and I believe I would
    be a good asset. If you ever want to take some of
    the load off, I'd love to write some material for your blog in exchange for
    a link back to mine. Please send me an email if interested.
    Cheers!

    Also visit my web site - latest apple iphone games

    ReplyDelete
  10. Thank you for the auspicious writeup. It inn reality
    was a amusement account it. Look complex to more added agreeable from you!
    However, how can we communicate?

    My web page ... pubic removal

    ReplyDelete
  11. Hey I know this is off topic but I was wondering if you knew of
    any widgets I could add to my blog that automatically tweet
    my newest twitter updates. I've been looking for
    a plug-in like this for quite some time and was hoping maybe you
    would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your
    blog and I look forward to your new updates.

    Here is my blog; latest games in iphone

    ReplyDelete
  12. Hi there very nice blog!! Guy .. Excellent .. Wonderful ..
    I will bookmark your blog and take the feeds additionally?
    I'm happy to search out a lot of helpful info right here within the put up, we want develop
    more strategies on this regard, thanks for sharing. . . . .

    .

    Feel free to visit my homepage Best Homemade Halloween Costumes ()

    ReplyDelete
  13. Very nice article, exactly what I needed.

    Here is my homepage latest iphone adventure games

    ReplyDelete
  14. We stumbled over here coming from a different web address and thought I should check things out.

    I like what I see so now i am following you.
    Look forward to finding out about your web page yet again.

    Review my weblog: latest iphone games 2012

    ReplyDelete
  15. Thanks , I've just been looking for info approximately this topic
    for a long time and yours is the greatest I've came upon till now.
    However, what about the bottom line? Are you certain concerning the supply?


    my page ... latest iphone games free download

    ReplyDelete
  16. My partner and I absolutely love your blog and find almost all of
    your post's to be just what I'm looking for. can you offer guest writers to write
    content to suit your needs? I wouldn't mind creating a post or elaborating on a lot
    of the subjects you write in relation to here. Again, awesome web
    site!

    My weblog Latex Mattress Topper Cal King Santa Ana

    ReplyDelete
  17. I have been exploring for a bit for any high quality articles or weblog posts
    in this sort of house . Exploring in Yahoo I ultimately stumbled
    upon this website. Reading this information So i'm satisfied to show that I have an incredibly good uncanny
    feeling I came upon exactly what I needed. I such a lot certainly will make sure to don?t overlook this website and provides it a glance regularly.



    my web site; latest iphone games list

    ReplyDelete
  18. Nice post. I was checking constantly this blog and I'm inspired!
    Very helpful information specifically the remaining section :) I deal with such info much.
    I was seeking this particular information for a very long
    time. Thanks and best of luck.

    Feel free to visit my web site :: 12 minute payday

    ReplyDelete
  19. This is a topic that's near to my heart... Manyy thanks! Where are your contact details though?


    Also visit my blog - game of war fire age hack tool

    ReplyDelete
  20. Hello, for all time i used to chheck webpage posts here in the early hiurs inn the daylight, foor thee reason that i love to learn more and more.


    Look into my blog post ... datingsite

    ReplyDelete
  21. Yоu ρrobably offer flyers and brochres as downloads
    fгom yоur website. Ƭheгe іs anotҺеr largе ɑmount оf specifics оf freelancing or telecommuting,
    ƅut outsie of books andd blogs, іt сan be hard to locate specific advice fߋr a
    work at home business. The bеst method іs uѕually to
    only send tҺe eails to users աhο maʏ have requested inclusion աith
    ɑn email mailing list, uѕually referred tօ as opt-іn lists.


    my web page - overweight people - -

    ReplyDelete
  22. Our Denver video clip manufacturing firm has
    a large amount of encounter in Colorado, regionally and also vast variety of
    video solutions, consists of producing advertising and marketing video clips that will certainly enlighten the audience as well as amuse,
    business videos, web video clip, client service, security training
    and also sales videos, Medical Videos, Promotional Video clip Manufacturing, Unique Occasions, Interviews, Information tales, Public Relations and Public Affairs, Construction and also Site Surveys,
    Sports, Docudrama Video clip Production, Video Editing as well as Blog post
    Production, Tv advertising, Video Assessment, vehicle commercials, Graphics and Animation,
    business meetings, Web & net Video clip
    Production.

    My web blog - wedding videos

    ReplyDelete