WSS Practice: Working with ListItems

I’m preparing for the WSS Application Developer’s exam, and looking through the thing’s you’re supposed to know about, I decided I needed some practice. I’m starting with the very basics – creating, updating and deleting List Items…

SPListItem itm = myList.Items.Add();
itm["Title"] = "Test Item";
itm["Data 1"] = "Flamingo";
itm["Data 2"] = DateTime.Now.ToUniversalTime().ToString() ;
Console.WriteLine("Item Created");
//*** Update the item
itm["Data 1"] = "Dalmation";
Console.WriteLine("Item Updated");
//*** Delete the item
Console.WriteLine("Item Deleted");

Not a lot to say about that really. It’s pretty obvious. I still find it interesting the way you sort of create an ’empty’ list item, and then have to fill in its data before updating it again to ‘create’ the item, but it makes sense. The other bits – well, pretty straight forward.

WSS Practice: Working with ListItems

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.