Pre-Populate a SharePoint List Instance

So, you want to provide a look-up in a SharePoint Site Definition and you’d quite like to provide your users with some options? (i.e. items in the source list)

Firstly you’re probably interested in this post from Josh Gaffy about adding a lookup column declaratively using CAML.

Next you’ll be wanting to use this snippet to declare your source list and the data it will contain.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
	<ListInstance FeatureId="89CA0ED1-8E9B-48fa-8C4D-CB406544D662"
			TemplateType="100"
			Title="Option List"
			OnQuickLaunch="TRUE"
			Description="Choices"
			Url="Options" >
		<Data>
			<Rows>
				<Row>
					<Field Name="Title">Foo</Field>
				</Row>
				<Row>
					<Field Name="Title">Bar</Field>
				</Row>
				<Row>
					<Field Name="Title">Fred</Field>
				</Row>
				<Row>
					<Field Name="Title">Mildred</Field>
				</Row>
				<Row>
					<Field Name="Title">Karl</Field>
				</Row>
				<Row>
					<Field Name="Title">Lenny</Field>
				</Row>
			</Rows>
		</Data>
	</ListInstance>
</Elements>

Hope that someone finds this useful.

About these ads
This entry was posted in CAML, Development, SharePoint. Bookmark the permalink.

One Response to Pre-Populate a SharePoint List Instance

  1. Gary says:

    Thanks bro!

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s