How to create lookup Column in List defintion using visual studio in sharepoint

5.7k Views Asked by At

I am creating Sharepoint List Defintion using visual studio.

1-ListA(Column 1,Column2,Column3)

2-ListB(Column4,Column5(lookup of column1))

I am craeting both list from one solution.

I want to craete a lookup Column in List B of List A,How to do it?

1

There are 1 best solutions below

1
On

you will have to provide the List property with the url of the original list, e.g. Lists/MyList and the ShowField property with the title of the original column, e.g. Title

<Field SourceID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
    ID="{D88EFB79-F93E-47FD-A8F0-EE0635A375FE}"
    Name="LookupColumn"
    DisplayName="Lookup Column"
    Group="My Custom Columns"
    Type="Lookup"
    List="Lists/LookupList"
    ShowField="Title"
    Required="FALSE"
    EnforceUniqueValues="FALSE"
    UnlimitedLengthInDocumentLibrary="FALSE"
    Overwrite="TRUE"/>

more details here

http://blogs.claritycon.com/blog/2011/05/provisioning-a-sharepoint-2010-lookup-column-with-caml/

update: archived link

https://web.archive.org/web/20150321053821/http://blogs.claritycon.com:80/blog/2011/05/provisioning-a-sharepoint-2010-lookup-column-with-caml/