LookUp for Site Definition in SharePoint.

Suppose we have created a site definition for an existing Site having two lists and one of the lists uses a lookup column that points to the other list.

Now if we are creating site using that site definition we will find our lookup column missing in the list.

If we check the schema.xml for our list, we will find our lookup field to be commented.

LookUp

To get it working ,  we need to define the field in the following manner

Original

<Field Type="Lookup" DisplayName="myLookUp" Required="FALSE" List="{72424dd2-9030-408a-97c9-8482d9d81204}" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" ID="{f50277a0-4da5-46d3-8e60-284c729a3eb8}" SourceID="{07e7832d-45df-4f69-b5bb-e31c5107c5ca}" StaticName="myLookUp" Name="myLookUp" ColName="int1" RowOrdinal="0" />

It should be modified to

<Field Type="Lookup"
DisplayName="myLookUp"
Required="FALSE"
 List="Lists/SecondList"
ShowField="Title"
ID="{f50277a0-4da5-46d3-8e60-284c729a3eb8}"
StaticName="myLookUp" Name="myLookUp" ></Field>

SecondList :- The name of the other list.

Check this wonderful post

http://www.mtelligent.com/journal/2007/10/14/adding-back-lookup-columns-in-the-provisioning-handler.html

 

Bye…


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Share your thoughts

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 )

Google+ photo

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

Connecting to %s