Wednesday, July 9, 2008

SharePoint 2007 Test Data Tool: How to Create List Items

I have mentioned this tool before, but if you are like me, your first thought of it is "how the heck do I use this?" Well, hopefully I can assist in getting you started from my trial and errors. First off, go download the MOSSDW 1.0.0.0 Beta and also download WSSDW 1.0.0.0 Beta (on the right side as an additional link). Pretty much download everything you can get your hands on in these respected sites. Once downloaded, I would put them in a directory like /MOSSDW and /WSSDW, respectively, so that you don't mix and match files.

Find the .CHM help file. You will want to perform these steps if you want to read it.

1 - Save the CHM file to your local machine

2 - Right click on the file and choose "Properties"

3 - In the properties page it will say "This file came from another computer and might be blocked to help protect this computer". Click the "Unblock" button next to this text.

4 - Click OK to close the properties window.

5 - Open the CHM file. You will now be able to view the contents.

The MOSSDW primarily seems to deal with higher level dealings like Site Collections, etc., while the WSSDW deals with the data like Content Types, Site Columns, Lists, Sub Sites, etc. So, you will want to look through the WSS XML samples.

Here is a code snippet of how to build an XML file that will create "5,000" List Items in the list of "MyCustomList" with a random title in the SubSite of "MyCustomSubSite" on the SharePoint Server of "http://MyMOSSServer". The Command Line string is assumming that you are currently in the folder you are calling the WSSDW and that your XML file is in the same directory folder.

-- This is an example of writing to a list in a MOSS Server environment (default values
are set in the SP GUI)

COMMAND LINE:

WSSDW MyFileName.XML http://MyMOSSServer/MySubSite (MySubSite is optional)

XML FILE:

<?xml version="1.0" encoding="utf-8" ?>

<WSSDWLib>
<VirtualServers url="http://MyMOSSServer/MyCustomSubSite" openmode="openexisting">
<ListItems num="5000" list="MyCustomList" title="$rand:5$" />
</VirtualServers>
</WSSDWLib>

I hope that will help get some of you started. Be sure to change the 5,000 number to something you need, otherwise you will have a lot of data on your hands. :)